Exemplo n.º 1
0
 internal RunnerRequirements(PluginRunner runner)
 {
     _layers = new List <RequirementLayer>();
     _final  = new Dictionary <object, FinalResult>();
     _runner = runner;
     _runner.ConfigManager.SolvedPluginConfiguration.Changed += SolvedPluginConfigurationChanged;
 }
Exemplo n.º 2
0
        public VMIContextViewModel( IContext context, IPluginConfigAccessor config, ILogService logService, IHelpService helpService )
        {
            DisplayName = "Object explorer";

            Context = context;
            Config = config;
            HelpService = helpService;

            InitializeCommands();

            _plugins = new Dictionary<IPluginInfo, VMIPlugin>();
            _allServices = new Dictionary<IServiceInfo, VMIService>();
            _dynamicServices = new Dictionary<IServiceInfo, VMIService>();
            _serviceRefs = new Dictionary<IServiceReferenceInfo, VMIService>();
            _assemblies = new Dictionary<IAssemblyInfo, VMIAssembly>();

            _pluginRunner = Context.GetService<PluginRunner>( true );
            _pluginRunner.ApplyDone += new EventHandler<ApplyDoneEventArgs>( OnApplyDone );

            NotificationService = context.GetService<INotificationService>();

            Assemblies = new VMCollection<VMIAssembly, IAssemblyInfo>( PluginRunner.Discoverer.AllAssemblies, FindOrCreate );
            Plugins = new VMCollection<VMIPlugin, IPluginInfo>( PluginRunner.Discoverer.AllPlugins.OrderBy( p => p.PublicName ), FindOrCreate );
            AllServices = new VMCollection<VMIService, IServiceInfo>( PluginRunner.Discoverer.AllServices, FindOrCreate );
            DynamicServices = new VMCollection<VMIService, IServiceInfo>( PluginRunner.Discoverer.AllServices.Where( p => p.IsDynamicService ), FindOrCreateDynamic );
            Categories = new ObservableCollection<VMIFolder>();

            _vmLogConfig = new VMLogConfig( this, logService );
            _vmLogConfig.Initialize();

            OsInfo = new VMOSInfo( this );

            VMApplicationInfo = new VMApplicationInfo( this );

            Dictionary<string, List<IPluginInfo>> categoryFolders = new Dictionary<string, List<IPluginInfo>>();
            foreach( IPluginInfo plugin in PluginRunner.Discoverer.AllPlugins )
            {
                foreach( string categ in plugin.Categories )
                {
                    List<IPluginInfo> col;
                    if( !categoryFolders.TryGetValue( categ, out col ) )
                    {
                        col = new List<IPluginInfo>();
                        col.Add( plugin );
                        categoryFolders.Add( categ, col );
                    }
                    else
                    {
                        col.Add( plugin );
                    }
                }
            }
            foreach( KeyValuePair<string, List<IPluginInfo>> item in categoryFolders )
            {
                VMCollection<VMAlias<VMIPlugin>, IPluginInfo> collection = new VMCollection<VMAlias<VMIPlugin>, IPluginInfo>( item.Value, ( info ) => { return new VMAlias<VMIPlugin>( FindOrCreate( info ), null ); } );
                VMIFolder folder = new VMIFolder( collection, item.Key );
                Categories.Add( folder );
            }
        }
Exemplo n.º 3
0
        MiniContext(string name)
        {
            ServiceContainer = new SimpleServiceContainer();

            ContextObject   = new object();
            ConfigContainer = SharedDictionary.Create(ServiceContainer);
            ConfigManager   = ConfigurationManager.Create(ConfigContainer).ConfigManager;
            PluginRunner    = new PluginRunner(ServiceContainer, ConfigManager);
            PluginRunner.Initialize(ContextObject);
            ServiceContainer.Add <IConfigContainer>(ConfigContainer);
        }
Exemplo n.º 4
0
        MiniContext( string name )
        {
            ServiceContainer = new SimpleServiceContainer();

            ContextObject = new object();
            ConfigContainer = SharedDictionary.Create( ServiceContainer );
            ConfigManager = ConfigurationManager.Create( ConfigContainer ).ConfigManager;
            PluginRunner = new PluginRunner( ServiceContainer, ConfigManager );
            PluginRunner.Initialize( ContextObject );
            ServiceContainer.Add<IConfigContainer>( ConfigContainer );
        }
Exemplo n.º 5
0
        public VMIPlugin( VMIContextViewModel ctx, IPluginInfo plugin, VMIBase parent )
            : base(ctx, parent)
        {
            _pluginInfo = plugin;

            Label = plugin.PublicName;
            Assembly = plugin.AssemblyInfo.AssemblyName;
            DetailsTemplateName = "PluginDetails";

            _systemPluginStatus = VMIContext.Context.ConfigManager.SystemConfiguration.PluginsStatus.GetStatus( Id, ConfigPluginStatus.Manual );
            _userPluginStatus = VMIContext.Context.ConfigManager.UserConfiguration.PluginsStatus.GetStatus( Id, ConfigPluginStatus.Manual );

            _pluginRunner = VMIContext.Context.GetService<PluginRunner>( true );
            _pluginRunner.ApplyDone += new EventHandler<ApplyDoneEventArgs>( OnApplyDone );

            VMIContext.Context.ConfigManager.UserConfiguration.LiveUserConfiguration.Changed += new EventHandler<LiveUserConfigurationChangedEventArgs>( OnLiveUserConfigurationChanged );
            VMIContext.Context.ConfigManager.SystemConfiguration.PluginsStatus.Changed += new EventHandler<PluginStatusCollectionChangedEventArgs>( OnSystemPluginStatusChanged );
            VMIContext.Context.ConfigManager.UserConfiguration.PluginsStatus.Changed += new EventHandler<PluginStatusCollectionChangedEventArgs>( OnUserPluginStatusChanged );

            VMIContext.Context.ConfigManager.UserConfiguration.PropertyChanged += new PropertyChangedEventHandler( OnUserConfigurationChanged );
            VMIContext.Context.ConfigManager.SystemConfiguration.PropertyChanged += new PropertyChangedEventHandler( OnSystemConfigurationChanged );

            CreateCommands();

            IList<IPluginInfo> editableBy = new List<IPluginInfo>();
            foreach( IPluginConfigAccessorInfo p in plugin.EditableBy )
                editableBy.Add( p.Plugin );
            _canEdit = new List<IPluginInfo>();
            foreach( IPluginConfigAccessorInfo p in _pluginInfo.EditorsInfo )
                _canEdit.Add( p.EditedSource );
            IList<IPluginInfo> required = new List<IPluginInfo>();

            _vmRequirementLayers = new List<VMIPluginRequirementLayer>();
            foreach( RequirementLayer layer in RequirementLayers )
            {
                _vmRequirementLayers.Add( new VMIPluginRequirementLayer( this, layer ) );
            }

            ServiceRefs = new VMCollection<VMAlias<VMIService>, IServiceReferenceInfo>( plugin.ServiceReferences, ( info ) => { return new VMAlias<VMIService>( VMIContext.FindOrCreate( info ), this ); } );
            CanEdit = new VMCollection<VMAlias<VMIPlugin>, IPluginInfo>( new CKReadOnlyListOnIList<IPluginInfo>( _canEdit ), ( info ) => { return new VMAlias<VMIPlugin>( VMIContext.FindOrCreate( info ), this ); } );
            EditableBy = new VMCollection<VMAlias<VMIPlugin>, IPluginInfo>( new CKReadOnlyListOnIList<IPluginInfo>( editableBy ), ( info ) => { return new VMAlias<VMIPlugin>( VMIContext.FindOrCreate( info ), this ); } );
        }
Exemplo n.º 6
0
        public VMIService( VMIContextViewModel ctx, IServiceReferenceInfo service, VMIBase parent )
            : base(ctx, parent)
        {
            _serviceRef = service;
            _service = service.Reference;
            Label = service.Reference.ServiceFullName;
            OnError = service.HasError;

            if( service.Reference.IsDynamicService )
                Assembly = service.Reference.AssemblyInfo.AssemblyName;

            _pluginRunner = VMIContext.Context.GetService<PluginRunner>( true );
            _pluginRunner.ApplyDone += new EventHandler<ApplyDoneEventArgs>( OnApplyDone );

            DetailsTemplateName = "ServiceRefDetails";
            _owner = new VMIPlugin( ctx, service.Owner, this );
            _reference = new VMIService( ctx, service.Reference, this );

            _allReferencingPlugins = new Dictionary<VMIPlugin,RunningRequirement>();
            ImplementedBy = new VMCollection<VMAlias<VMIPlugin>, IPluginInfo>( _service.Implementations, ( info ) => { return new VMAlias<VMIPlugin>( VMIContext.FindOrCreate( info ), this ); } );
        }
Exemplo n.º 7
0
        public VMIService( VMIContextViewModel ctx, IServiceInfo service, VMIBase parent )
            : base(ctx, parent)
        {
            _service = service;
            Label = service.ServiceFullName;
            if( !service.HasError && service.Implementations.Count == 0 )
                ErrorMessage = "No implementation";
            else
                ErrorMessage = _service.ErrorMessage;
            OnError = ErrorMessage != null;

            if( service.IsDynamicService )
                Assembly = service.AssemblyInfo.AssemblyName;

            DetailsTemplateName = "ServiceDetails";

            _pluginRunner = VMIContext.Context.GetService<PluginRunner>( true );
            _pluginRunner.ApplyDone += new EventHandler<ApplyDoneEventArgs>( OnApplyDone );

            _allReferencingPlugins = new Dictionary<VMIPlugin, RunningRequirement>();
            ImplementedBy = new VMCollection<VMAlias<VMIPlugin>, IPluginInfo>( _service.Implementations, ( info ) => { return new VMAlias<VMIPlugin>( VMIContext.FindOrCreate( info ), null ); } );
        }
Exemplo n.º 8
0
        /// <summary>
        /// Launches Initialization of the VMLogConfig
        /// </summary>
        public void Initialize()
        {
            _services.Clear();
            FillFromDiscoverer( _services );

            LogEntriesContainer.MaxCount = Config.User.GetOrSet( OUTPUT_MAX_COUNT, 100 );
            DoLog = Config.User.GetOrSet( GLOBAL_LOGS, true );

            _hostConfiguration = new ServiceHostConfiguration( this );
            _pluginRunner = _vmiContext.Context.GetService<PluginRunner>( true );
            _vmiContext.Context.PluginRunner.ServiceHost.Add( _hostConfiguration );

            Apply();

            if( _logService != null ) //The service is set as "Optional TryStart", prevent any null ref exception
                _logService.LogTriggered += new LogTriggeredEventHandler( OnLogTriggered );
        }
Exemplo n.º 9
0
 internal RunningConfiguration(PluginRunner r)
 {
     _runner = r;
 }