Ignore:
Timestamp:
Jun 10, 2010, 3:26:32 PM (11 years ago)
Author:
kopal
Message:
  • a delete of a plugin now leads to the delete of all left connections
  • added a first version of a Settings to the WorkspaceManager
  • some small bug fixes
File:
1 edited

Legend:

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

    r1610 r1617  
    3737        [NonSerialized]
    3838        private IPlugin plugin;
    39      
     39       
     40        /// <summary>
     41        /// This is the current index of the image which should be shown
     42        /// on the plugins view
     43        /// </summary>
    4044        private int imageIndex = 0;
    4145       
     
    5256        /// <summary>
    5357        /// The wrapped IPlugin of this PluginModel
     58        /// if there is currently no plugin instance it
     59        /// will automatically create one. Otherwise
     60        /// this acts as singleton and returns the created
     61        /// instance
    5462        /// </summary>
    5563        public IPlugin Plugin{
     
    177185        /// <summary>
    178186        /// Checks wether this PluginModel is executable or not and sets the isExecutable bool
    179         /// </summary>
    180         /// <returns></returns>
     187        ///
     188        /// There are 3 ways in that a plugin can be executable:
     189        ///     1. All mandatory inputs are set + all outputs are "free"
     190        ///     2. There are no mandatory inputs and at least one non-mandatory input is set + all outputs are "free"
     191        ///     3. There are no inputs + all outputs are "free"
     192        /// </summary>
    181193        public void checkExecutable(ProtocolBase protocolBase)
    182194        {                           
    183195            bool AtLeastOneInputSet = false;
    184196            //First test if every mandatory Connector has data
     197            //or one non-mandatory input has data
    185198            foreach (ConnectorModel connectorModel in this.InputConnectors)
    186199            {
     
    196209            }
    197210
    198             //Next test if every connected Connection is not active
     211            //Next test if every connected output Connection is not active
    199212            foreach (ConnectorModel connectorModel in this.OutputConnectors)
    200213            {
     
    212225                MessagePreExecution msg = new MessagePreExecution();
    213226                msg.PluginModel = this;
    214                 protocolBase.BroadcastMessageReliably(msg);
     227               
     228                //protocolBase is set at Startup of the ExecutionEngine
     229                //but it could be that we have an event before setting
     230                //of the protocl base (triggered by user clicking on
     231                //a plugins presentation (button or so))
     232                if (protocolBase != null)
     233                {
     234                    protocolBase.BroadcastMessageReliably(msg);
     235                }
    215236            }
    216237            return;
     
    224245        public void PluginProgressChanged(IPlugin sender, PluginProgressEventArgs args)
    225246        {
     247            //Calculate % of the plugins process
    226248            this.PercentageFinished = args.Value / args.Max;
     249            //Tell the ExecutionEngine that this plugin needs a gui update
     250            this.GuiNeedsUpdate = true;
    227251        }
    228252
     
    237261            {
    238262                this.imageIndex = args.ImageIndex;
    239                 if (this.WorkspaceModel.WorkspaceManagerEditor.isExecuting())
    240                 {
    241                     this.GuiNeedsUpdate = true;
    242                 }
    243                 else
    244                 {
    245                     this.WorkspaceModel.WorkspaceManagerEditor.Presentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    246                     {
    247                         this.UpdateableView.update();
    248                     }, null);
    249                 }
    250             }
    251         }
    252 
    253         /// <summary>
    254         ///
     263            }
     264               
     265            if (this.WorkspaceModel.WorkspaceManagerEditor.isExecuting())
     266            {
     267                this.GuiNeedsUpdate = true;
     268            }
     269            else
     270            {
     271                this.WorkspaceModel.WorkspaceManagerEditor.Presentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
     272                {
     273                    this.UpdateableView.update();
     274                }, null);
     275            }           
     276        }
     277
     278        /// <summary>
     279        /// The pluginProtocol of the current ExecutionEngine run to set/get
    255280        /// </summary>
    256281        public PluginProtocol PluginProtocol { get; set; }
Note: See TracChangeset for help on using the changeset viewer.