public ConfigFeatureStarter( ConfigManager configManager, ISimplePluginRunner runner, PluginCluster pluginCluster ) : base(configManager) { _pluginCluster = pluginCluster; _runner = runner; _runner.PluginHost.StatusChanged += ( o, e ) => { if( _pluginCluster.StartWithPlugin.Contains( e.PluginProxy.PluginKey.PluginId ) || _pluginCluster.StopWithPlugin.Contains( e.PluginProxy.PluginKey.PluginId ) ) { NotifyOfPropertyChange( () => Start ); NotifyOfPropertyChange( () => Stop ); NotifyOfPropertyChange( () => IsRunning ); NotifyOfPropertyChange( () => IsRunnable ); } }; Start = new SimpleCommand( StartPlugin, CanStart ); Stop = new SimpleCommand( StopPlugin ); }
/// <summary> /// Ctor of a ConfigFeatureStarter. /// Be careful with the list of Guid passed as parameter. /// When stopped, ALL these plugins' user configuration will be set to Manual and receive a "Stop" LiveUserAction. /// Plugins that are used by other plugins/feature must not be added in this list. (use service requirements in the plugins when possible) /// </summary> /// <param name="configManager"></param> /// <param name="runner"></param> /// <param name="userConfig"></param> /// <param name="mainPluginIds"></param> public ConfigFeatureStarter( ConfigManager configManager, ISimplePluginRunner runner, IUserConfiguration userConfig, params Guid[] mainPluginIds ) : base(configManager) { _pluginIds = mainPluginIds; _runner = runner; _userConfig = userConfig; _runner.PluginHost.StatusChanged += ( o, e ) => { if( _pluginIds.Contains( e.PluginProxy.PluginKey.PluginId ) ) { NotifyOfPropertyChange( () => Start ); NotifyOfPropertyChange( () => Stop ); NotifyOfPropertyChange( () => IsRunning ); NotifyOfPropertyChange( () => IsRunnable ); } }; Start = new SimpleCommand( StartPlugin, CanStart ); Stop = new SimpleCommand( StopPlugin ); }