Пример #1
0
 public PluginControl(Plugin plugin)
 {
     this.PlugIn = plugin;
       this.Name = plugin.Name;
       this.Version = plugin.Version;
 }
Пример #2
0
        /// <summary>
        /// finalize plugin
        /// save its status for later initialization
        /// shutdown the plugin
        /// </summary>
        /// <param name="plugin">the plugin to finalize</param>
        private Task FinalizePlugin(Plugin plugin, IStatusDisplay reporter)
        {
            //delegate method called when the task fails
              var OnPluginStopFail = new Action<Task>(t =>
              {
            var msg = string.Format("Error stopping plugin: {0}", t.Exception.Message);
            this._host.Log(MessageLevel.Warning
              , msg
              , plugin);
              });

              return Task.Factory.StartNew(() =>
              {
            //TODO finish this see above.
            //TODO save plugin status

            //stop plugin
            var stopTask = plugin.Stop(reporter);
            stopTask.ContinueWith(OnPluginStopFail, TaskContinuationOptions.OnlyOnFaulted);
              });
        }