Пример #1
0
        public SnapshotMakeViewModel(IDsmApplication application)
        {
            _application = application;

            Title               = "Make snapshot";
            Description         = "";
            AcceptChangeCommand = new RelayCommand <object>(AcceptChangeExecute, AcceptChangeCanExecute);
        }
Пример #2
0
        public MatrixViewModel(IMainViewModel mainViewModel, IDsmApplication application, IEnumerable <IDsmElement> selectedElements)
        {
            _mainViewModel    = mainViewModel;
            _application      = application;
            _selectedElements = selectedElements;

            ToggleElementExpandedCommand = mainViewModel.ToggleElementExpandedCommand;

            SortElementCommand     = mainViewModel.SortElementCommand;
            MoveUpElementCommand   = mainViewModel.MoveUpElementCommand;
            MoveDownElementCommand = mainViewModel.MoveDownElementCommand;

            CreateElementCommand       = mainViewModel.CreateElementCommand;
            ChangeElementNameCommand   = mainViewModel.ChangeElementNameCommand;
            ChangeElementTypeCommand   = mainViewModel.ChangeElementTypeCommand;
            ChangeElementParentCommand = mainViewModel.ChangeElementParentCommand;
            DeleteElementCommand       = mainViewModel.DeleteElementCommand;

            ShowElementIngoingRelationsCommand  = new RelayCommand <object>(ShowElementIngoingRelationsExecute, ShowElementIngoingRelationsCanExecute);
            ShowElementOutgoingRelationCommand  = new RelayCommand <object>(ShowElementOutgoingRelationExecute, ShowElementOutgoingRelationCanExecute);
            ShowElementinternalRelationsCommand = new RelayCommand <object>(ShowElementinternalRelationsExecute, ShowElementinternalRelationsCanExecute);

            ShowElementConsumersCommand          = new RelayCommand <object>(ShowElementConsumersExecute, ShowConsumersCanExecute);
            ShowElementProvidedInterfacesCommand = new RelayCommand <object>(ShowProvidedInterfacesExecute, ShowElementProvidedInterfacesCanExecute);
            ShowElementRequiredInterfacesCommand = new RelayCommand <object>(ShowElementRequiredInterfacesExecute, ShowElementRequiredInterfacesCanExecute);
            ShowCellDetailMatrixCommand          = mainViewModel.ShowCellDetailMatrixCommand;

            CreateRelationCommand       = mainViewModel.CreateRelationCommand;
            ChangeRelationWeightCommand = mainViewModel.ChangeRelationWeightCommand;
            ChangeRelationTypeCommand   = mainViewModel.ChangeRelationTypeCommand;
            DeleteRelationCommand       = mainViewModel.DeleteRelationCommand;

            ShowCellRelationsCommand        = new RelayCommand <object>(ShowCellRelationsExecute, ShowCellRelationsCanExecute);
            ShowCellConsumersCommand        = new RelayCommand <object>(ShowCellConsumersExecute, ShowCellConsumersCanExecute);
            ShowCellProvidersCommand        = new RelayCommand <object>(ShowCellProvidersExecute, ShowCellProvidersCanExecute);
            ShowElementDetailMatrixCommand  = mainViewModel.ShowElementDetailMatrixCommand;
            ShowElementContextMatrixCommand = mainViewModel.ShowElementContextMatrixCommand;

            ToggleMetricsViewExpandedCommand = new RelayCommand <object>(ToggleMetricsViewExpandedExecute, ToggleMetricsViewExpandedCanExecute);

            PreviousMetricCommand = new RelayCommand <object>(PreviousMetricExecute, PreviousMetricCanExecute);
            NextMetricCommand     = new RelayCommand <object>(NextMetricExecute, NextMetricCanExecute);

            Reload();

            ZoomLevel = 1.0;

            _metricTypeNames = new Dictionary <MetricType, string>();
            _metricTypeNames[MetricType.NumberOfElements]   = "Internal Elements";
            _metricTypeNames[MetricType.IngoingRelations]   = "Ingoing Relations";
            _metricTypeNames[MetricType.OutgoingRelations]  = "Outgoing Relations";
            _metricTypeNames[MetricType.InternalRelations]  = "Internal Relations";
            _metricTypeNames[MetricType.HierarchicalCycles] = "Hierarchical Cycles";
            _metricTypeNames[MetricType.SystemCycles]       = "System Cycles";

            _selectedMetricType    = MetricType.NumberOfElements;
            SelectedMetricTypeName = _metricTypeNames[_selectedMetricType];
        }
Пример #3
0
        public RelationEditWeightViewModel(IDsmApplication application, IDsmRelation relation)
        {
            _application = application;
            _relation    = relation;

            Title  = "Edit relation";
            Weight = relation.Weight;
            AcceptChangeCommand = new RelayCommand <object>(AcceptChangeExecute, AcceptChangeCanExecute);
        }
Пример #4
0
        public RelationEditTypeViewModel(IDsmApplication application, IDsmRelation relation)
        {
            _application = application;
            _relation    = relation;

            Title = "Edit relation type";
            Type  = relation.Type;
            AcceptChangeCommand = new RelayCommand <object>(AcceptChangeExecute, AcceptChangeCanExecute);
        }
Пример #5
0
        public ElementEditNameViewModel(IDsmApplication application, IDsmElement element)
        {
            _application = application;
            _element     = element;

            Title = $"Edit element name {element.Fullname}";
            Name  = _element.Name;

            AcceptChangeCommand = new RelayCommand <object>(AcceptChangeExecute, AcceptChangeCanExecute);
        }
Пример #6
0
        public RelationCreateViewModel(IDsmApplication application, IDsmElement consumer, IDsmElement provider)
        {
            _application = application;
            _consumer    = consumer;
            _provider    = provider;

            Title  = $"Create relation between {consumer.Fullname} and {provider.Fullname}";
            Type   = "";
            Weight = 1;
            AcceptChangeCommand = new RelayCommand <object>(AcceptChangeExecute, AcceptChangeCanExecute);
        }
Пример #7
0
        public ElementCreateViewModel(IDsmApplication application, IDsmElement element)
        {
            _application = application;
            _element     = element;

            Title = $"Create child element for {element.Fullname}";
            Name  = "";
            Type  = "";

            AcceptChangeCommand = new RelayCommand <object>(AcceptChangeExecute, AcceptChangeCanExecute);
        }
Пример #8
0
        public ActionListViewModel(IDsmApplication application)
        {
            Title = "Actions";

            _application = application;
            _application.ActionPerformed += OnActionPerformed;

            UpdateActionList();

            CopyToClipboardCommand = new RelayCommand <object>(CopyToClipboardExecute);
            ClearCommand           = new RelayCommand <object>(ClearExecute);
        }
Пример #9
0
        public SettingsViewModel(IDsmApplication application)
        {
            _application     = application;
            _supportedThemes = new Dictionary <Theme, string>();
            //_supportedThemes[Theme.Dark] = DarkThemeName;
            _supportedThemes[Theme.Pastel] = PastelThemeName;
            _supportedThemes[Theme.Light]  = LightThemeName;

            LoggingEnabled    = ViewerSetting.LoggingEnabled;
            ShowCycles        = ViewerSetting.ShowCycles;
            SelectedThemeName = _supportedThemes[ViewerSetting.Theme];

            _application.ShowCycles = ShowCycles;

            AcceptChangeCommand = new RelayCommand <object>(AcceptChangeExecute, AcceptChangeCanExecute);
        }
Пример #10
0
        public MainViewModel(IDsmApplication application)
        {
            _application                  = application;
            _application.Modified        += OnModelModified;
            _application.ActionPerformed += OnActionPerformed;

            OpenFileCommand = new RelayCommand <object>(OpenFileExecute, OpenFileCanExecute);
            SaveFileCommand = new RelayCommand <object>(SaveFileExecute, SaveFileCanExecute);

            HomeCommand = new RelayCommand <object>(HomeExecute, HomeCanExecute);

            MoveUpElementCommand   = new RelayCommand <object>(MoveUpElementExecute, MoveUpElementCanExecute);
            MoveDownElementCommand = new RelayCommand <object>(MoveDownElementExecute, MoveDownElementCanExecute);
            SortElementCommand     = new RelayCommand <object>(SortElementExecute, SortElementCanExecute);

            ShowElementDetailMatrixCommand  = new RelayCommand <object>(ShowElementDetailMatrixExecute, ShowElementDetailMatrixCanExecute);
            ShowElementContextMatrixCommand = new RelayCommand <object>(ShowElementContextMatrixExecute, ShowElementContextMatrixCanExecute);
            ShowCellDetailMatrixCommand     = new RelayCommand <object>(ShowCellDetailMatrixExecute, ShowCellDetailMatrixCanExecute);

            ZoomInCommand  = new RelayCommand <object>(ZoomInExecute, ZoomInCanExecute);
            ZoomOutCommand = new RelayCommand <object>(ZoomOutExecute, ZoomOutCanExecute);
            ToggleElementExpandedCommand = new RelayCommand <object>(ToggleElementExpandedExecute, ToggleElementExpandedCanExecute);

            UndoCommand = new RelayCommand <object>(UndoExecute, UndoCanExecute);
            RedoCommand = new RelayCommand <object>(RedoExecute, RedoCanExecute);

            OverviewReportCommand = new RelayCommand <object>(OverviewReportExecute, OverviewReportCanExecute);

            NavigateToNextCommand     = new RelayCommand <object>(NavigateToNextExecute, NavigateToNextCanExecute);
            NavigateToPreviousCommand = new RelayCommand <object>(NavigateToPreviousExecute, NavigateToPreviousCanExecute);

            CreateElementCommand       = new RelayCommand <object>(CreateElementExecute, CreateElementCanExecute);
            DeleteElementCommand       = new RelayCommand <object>(DeleteElementExecute, DeleteElementCanExecute);
            ChangeElementParentCommand = new RelayCommand <object>(MoveElementExecute, MoveElementCanExecute);
            ChangeElementNameCommand   = new RelayCommand <object>(ChangeElementNameExecute, ChangeElementNameCanExecute);
            ChangeElementTypeCommand   = new RelayCommand <object>(ChangeElementTypeExecute, ChangeElementTypeCanExecute);

            CreateRelationCommand       = new RelayCommand <object>(CreateRelationExecute, CreateRelationCanExecute);
            DeleteRelationCommand       = new RelayCommand <object>(DeleteRelationExecute, DeleteRelationCanExecute);
            ChangeRelationWeightCommand = new RelayCommand <object>(ChangeRelationWeightExecute, ChangeRelationWeightCanExecute);
            ChangeRelationTypeCommand   = new RelayCommand <object>(ChangeRelationTypeExecute, ChangeRelationTypeCanExecute);

            MakeSnapshotCommand = new RelayCommand <object>(MakeSnapshotExecute, MakeSnapshotCanExecute);
            ShowHistoryCommand  = new RelayCommand <object>(ShowHistoryExecute, ShowHistoryCanExecute);
            ShowSettingsCommand = new RelayCommand <object>(ShowSettingsExecute, ShowSettingsCanExecute);

            TakeScreenshotCommand = new RelayCommand <object>(TakeScreenshotExecute);

            _modelFilename = "";
            _title         = "DSM Viewer";
            _isModified    = false;
            _isLoaded      = false;

            _searchText  = "";
            _searchState = SearchState.NoMatch;

            _selectedSortAlgorithm = SupportedSortAlgorithms[0];

            _progressViewModel = new ProgressViewModel();

            ActiveMatrix = new MatrixViewModel(this, _application, new List <IDsmElement>());
        }