Exemplo n.º 1
0
        internal PluginInfo(string pluginFullName, IAssemblyInfo assemblyInfo, ServiceInfo service = null)
        {
            Debug.Assert(assemblyInfo != null);

            _pluginFullName = pluginFullName;
            _assemblyInfo   = assemblyInfo;

            _service           = service;
            _serviceReferences = new CKObservableSortedArrayList <MockServiceReferenceInfo>((x, y) => String.CompareOrdinal(x.Reference.ServiceFullName, y.Reference.ServiceFullName), false);
        }
Exemplo n.º 2
0
        internal ServiceInfo(string serviceFullName, IAssemblyInfo assemblyInfo, IServiceInfo generalization = null)
        {
            Debug.Assert(!String.IsNullOrEmpty(serviceFullName));
            Debug.Assert(assemblyInfo != null);

            _serviceFullName = serviceFullName;
            _assemblyInfo    = assemblyInfo;
            _generalization  = generalization;
            _implementations = new CKObservableSortedArrayList <PluginInfo>((a, b) => CaseInsensitiveComparer.Default.Compare(a.PluginFullName, b.PluginFullName), false);
        }
Exemplo n.º 3
0
        internal PluginInfo( string pluginFullName, IAssemblyInfo assemblyInfo, ServiceInfo service = null )
        {
            Debug.Assert( assemblyInfo != null );

            _pluginFullName = pluginFullName;
            _assemblyInfo = assemblyInfo;

            _service = service;
            _serviceReferences = new CKObservableSortedArrayList<MockServiceReferenceInfo>( ( x, y ) => String.CompareOrdinal( x.Reference.ServiceFullName, y.Reference.ServiceFullName ), false );
        }
Exemplo n.º 4
0
        internal ServiceInfo( string serviceFullName, IAssemblyInfo assemblyInfo, IServiceInfo generalization = null )
        {
            Debug.Assert( !String.IsNullOrEmpty( serviceFullName ) );
            Debug.Assert( assemblyInfo != null );

            _serviceFullName = serviceFullName;
            _assemblyInfo = assemblyInfo;
            _generalization = generalization;
            _implementations = new CKObservableSortedArrayList<PluginInfo>( ( a, b ) => CaseInsensitiveComparer.Default.Compare( a.PluginFullName, b.PluginFullName ), false );
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new instance of this ViewModel.
        /// </summary>
        /// <param name="loadDefaultState">True if the default XML state should be loaded, false to start on an empty state.</param>
        public MainWindowViewModel( bool loadDefaultState = false )
        {
            _recentFiles = new CKObservableSortedArrayList<RecentFile>( ( a, b ) => DateTime.Compare( b.AccessTime, a.AccessTime ) );

            // Lab objects, live objects and static infos are managed in the LabStateManager.
            _labStateManager = new LabStateManager();
            _engine = _labStateManager.Engine;

            _labStateManager.Engine.PropertyChanged += Engine_PropertyChanged;
            _labStateManager.ServiceInfos.CollectionChanged += ServiceInfos_CollectionChanged;
            _labStateManager.PluginInfos.CollectionChanged += PluginInfos_CollectionChanged;
            _labStateManager.RunningPlugins.CollectionChanged += RunningPlugins_CollectionChanged;

            _engine.Configuration.Layers.CollectionChanged += Layers_CollectionChanged;

            _activityMonitor = new ActivityMonitor();

            _activityMonitor.OpenTrace().Send( "Hello world" );

            _graph = new YodiiGraph( _engine.Configuration, _labStateManager );

            _removeSelectedVertexCommand = new RelayCommand( RemoveSelectedVertexExecute, CanEditSelectedVertex );
            _toggleEngineCommand = new RelayCommand( ToggleEngineExecute );
            _openFileCommand = new RelayCommand( OpenFileExecute );
            _saveAsFileCommand = new RelayCommand( SaveAsFileExecute );
            _saveCommand = new RelayCommand( SaveExecute ); // Save is always available.e
            _reorderGraphLayoutCommand = new RelayCommand( ReorderGraphLayoutExecute );
            _createPluginCommand = new RelayCommand( CreatePluginExecute, CanEditItems );
            _createServiceCommand = new RelayCommand( CreateServiceExecute, CanEditItems );
            _openConfigurationEditorCommand = new RelayCommand( OpenConfigurationEditorExecute );
            _newFileCommand = new RelayCommand( NewFileExecute );
            _revokeAllCommandsCommand = new RelayCommand( RevokeAllCommandsExecute, CanRevokeAllCommands );
            _autoPositionCommand = new RelayCommand( AutoPositionExecute );

            LoadRecentFiles();

            // Appication is only available on WPF context.
            if( Application.Current != null )
            {
                _autosaveTimer = new DispatcherTimer( DispatcherPriority.Background, Application.Current.Dispatcher );
            }
            else
            {
                _autosaveTimer = new DispatcherTimer( DispatcherPriority.Background, Dispatcher.CurrentDispatcher );
            }

            _autosaveTimer.Interval = new TimeSpan( 0, 0, 5 );
            _autosaveTimer.Tick += AutosaveTick;

            // Autosave timer is started from outside, using StartAutosaveTimer().

            if( loadDefaultState ) LoadDefaultState();
        }