Changeset 1562


Ignore:
Timestamp:
Jun 1, 2010, 11:40:31 PM (12 years ago)
Author:
kopal
Message:
  • replaced x,y.coordinates of PluginModel with a Point
  • Fetched OnPluginProgressChanged now by PluginModel and automatically set PercentageFinished
  • some small fixes
Location:
trunk/CrypPlugins/WorkspaceManager
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/WorkspaceManager/Model/PluginModel.cs

    r1556 r1562  
    3838
    3939        [NonSerialized]
    40         private PluginModelState executionstate = PluginModelState.UNDEFINED;
     40        private PluginModelState executionstate = PluginModelState.Undefined;
    4141
    4242        /// <summary>
     
    7272        /// </summary>       
    7373        public Type PluginType = null;
    74 
    75         /// <summary>
    76         /// Stores if this Plugin is executable
    77         /// </summary>
    78         private bool executable = false;
    79 
     74       
    8075        /// <summary>
    8176        /// Is the Plugin actually minimized?
     
    123118                        connectorModel.IsMandatory = propertyInfoAttribute.Mandatory;
    124119                        connectorModel.PropertyName = propertyInfoAttribute.PropertyName;
     120                        connectorModel.ConnectorOrientation = ConnectorOrientation.West;
    125121                        InputConnectors.Add(connectorModel);
    126122                        WorkspaceModel.AllConnectorModels.Add(connectorModel);
     
    134130                        connectorModel.IsMandatory = propertyInfoAttribute.Mandatory;
    135131                        connectorModel.PropertyName = propertyInfoAttribute.PropertyName;
     132                        connectorModel.ConnectorOrientation = ConnectorOrientation.East;
    136133                        connectorModel.Outgoing = true;
    137134                        Plugin.PropertyChanged += connectorModel.PropertyChangedOnPlugin;
     
    182179        public void checkExecutable()
    183180        {
    184             if(ExecutionState == PluginModelState.UNDEFINED){
     181            if(ExecutionState == PluginModelState.Undefined){
    185182
    186183                mutex.WaitOne();
     
    209206                }
    210207
    211                 ExecutionState = PluginModelState.EXECUTABLE;
     208                ExecutionState = PluginModelState.Executable;
    212209                mutex.ReleaseMutex();
    213210            }
    214211            return;
    215212        }
    216        
     213
     214        /// <summary>
     215        /// Progress of the plugin changed
     216        /// </summary>
     217        /// <param name="sender"></param>
     218        /// <param name="args"></param>
     219        public void PluginProgressChanged(IPlugin sender, PluginProgressEventArgs args)
     220        {
     221            this.PercentageFinished = args.Value / args.Max;
     222        }
    217223    }
    218224
     
    222228    public enum PluginModelState
    223229    {
    224         UNDEFINED,
    225         EXECUTABLE,
    226         PRE_EXECUTING,
    227         EXECUTING,
    228         POST_EXECUTING,
    229         TERMINATED,
    230         ERROR
     230        Undefined,
     231        Executable,
     232        PreExecuting,
     233        Executing,
     234        PostExecuting,
     235        Terminated,
     236        Error
    231237    }
    232238}
  • trunk/CrypPlugins/WorkspaceManager/Model/WorkspaceModel.cs

    r1556 r1562  
    2020using System.Linq;
    2121using System.Text;
     22using System.Windows;
    2223using Cryptool.PluginBase;
    2324
     
    7071        /// <param name="pluginType"></param>
    7172        /// <returns></returns>
    72         public PluginModel newPluginModel(double x, double y, double width, double height, Type pluginType)
     73        public PluginModel newPluginModel(Point position, double width, double height, Type pluginType)
    7374        {
    7475            PluginModel pluginModel = new PluginModel();
    7576            pluginModel.WorkspaceModel = this;
    76             pluginModel.X = x;
    77             pluginModel.Y = y;
     77            pluginModel.Position = position;
    7878            pluginModel.Width = width;
    7979            pluginModel.Height = height;
     
    8282            pluginModel.Name = pluginType.Name;
    8383            pluginModel.Plugin.OnGuiLogNotificationOccured += this.WorkspaceManagerEditor.GuiLogNotificationOccured;
     84            pluginModel.Plugin.OnPluginProgressChanged += pluginModel.PluginProgressChanged;
    8485            this.AllPluginModels.Add(pluginModel);
    8586            return pluginModel;
     
    9495        public PluginModel newPluginModel(Type pluginType)
    9596        {
    96             return newPluginModel(0, 0, 0, 0, pluginType);
    97         }
    98 
    99         /// <summary>
    100         /// Creates a new ConnectorModel belonging to this WorkspaceModel
    101         /// </summary>
    102         /// <param name="pluginModel"></param>
    103         /// <param name="connectorType"></param>
    104         /// <returns></returns>
    105         private ConnectorModel newConnectorModel(PluginModel pluginModel, Type connectorType)
    106         {
    107             ConnectorModel connectorModel = new ConnectorModel();
    108             connectorModel.WorkspaceModel = this;
    109             connectorModel.PluginModel = pluginModel;
    110             connectorModel.ConnectorType = connectorType;
    111             this.AllConnectorModels.Add(connectorModel);
    112             return connectorModel;
    113         }
     97            return newPluginModel(new Point(0, 0), 0, 0, pluginType);
     98        }       
    11499
    115100        /// <summary>
     
    207192            foreach (PluginModel pluginModel in this.AllPluginModels)
    208193            {
    209                 pluginModel.ExecutionState = PluginModelState.UNDEFINED;
     194                pluginModel.ExecutionState = PluginModelState.Undefined;
    210195            }
    211196            foreach (ConnectionModel connection in this.AllConnectionModels)
  • trunk/CrypPlugins/WorkspaceManager/WorkspaceManager.cs

    r1556 r1562  
    3333using WorkspaceManager.View.Container;
    3434using WorkspaceManager.View.Converter;
     35using System.Windows;
    3536
    3637//Disable warnings for unused or unassigned fields and events:
     
    162163            if (!executing)
    163164            {
    164                 PluginModel newPluginModel = WorkspaceModel.newPluginModel(10, 10, 100, 100, type);
     165                PluginModel newPluginModel = WorkspaceModel.newPluginModel(new Point(10, 10), 100, 100, type);
    165166                GuiLogMessage("Added by double click: " + newPluginModel.Name, NotificationLevel.Info);
    166167                HasChanges = true;
Note: See TracChangeset for help on using the changeset viewer.