Exemplo n.º 1
0
        public MainWindowViewModel(IProjectService projectService, IDialogService dialogService, IImportService importService, IExportService exportService,
			IImageExportService imageExportService, IAnalysisService analysisService, InputViewModel input, CompareViewModel compare, AnalyzeViewModel analyze)
            : base("Cog", input, compare, analyze)
        {
            _dialogService = dialogService;
            _importService = importService;
            _exportService = exportService;
            _imageExportService = imageExportService;
            _projectService = projectService;
            _analysisService = analysisService;

            _newCommand = new RelayCommand(New);
            _openCommand = new RelayCommand(Open);
            _saveCommand = new RelayCommand(Save, CanSave);
            _saveAsCommand = new RelayCommand(SaveAs);
            _importWordListsCommand = new RelayCommand(ImportWordLists);
            _importGeographicRegionsCommand = new RelayCommand(ImportGeographicRegions);
            _exportWordListsCommand = new RelayCommand(ExportWordLists, CanExportWordLists);
            _exportSimilarityMatrixCommand = new RelayCommand(ExportSimilarityMatrix, CanExportSimilarityMatrix);
            _exportCognateSetsCommand = new RelayCommand(ExportCognateSets, CanExportCognateSets);
            _exportSegmentFrequenciesCommand = new RelayCommand(ExportSegmentFrequencies, CanExportSegmentFrequencies);
            _exportHierarchicalGraphCommand = new RelayCommand(ExportHierarchicalGraph, CanExportHierarchicalGraph);
            _exportNetworkGraphCommand = new RelayCommand(ExportNetworkGraph, CanExportNetworkGraph);
            _exportGlobalCorrespondencesChartCommand = new RelayCommand(ExportGlobalCorrespondencesChart, CanExportGlobalCorrespondencesChart);
            _performComparisonCommand = new RelayCommand(PerformComparison, CanPerformComparison);
            _runStemmerCommand = new RelayCommand(RunStemmer, CanRunStemmer);
            _aboutCommand = new RelayCommand(ShowAbout);
            _showTutorialCommand = new RelayCommand(() => Process.Start("https://github.com/sillsdev/cog/wiki/Cog-Tutorial"));
            _showGettingStartedCommand = new RelayCommand(ShowGettingStarted);

            foreach (ContainerViewModelBase childView in Views.OfType<ContainerViewModelBase>())
                childView.PropertyChanging += childView_PropertyChanging;

            PropertyChanging += OnPropertyChanging;

            _nullCommand = new RelayCommand(() => {}, () => false);
            _findCommand = _nullCommand;
            Messenger.Default.Register<SwitchViewMessage>(this, HandleSwitchView);
            Messenger.Default.Register<HookFindMessage>(this, msg => FindCommand = msg.FindCommand ?? _nullCommand);
        }
Exemplo n.º 2
0
        public MainWindowViewModel(IProjectService projectService, IDialogService dialogService, IImportService importService, IExportService exportService,
                                   IImageExportService imageExportService, IAnalysisService analysisService, InputViewModel input, CompareViewModel compare, AnalyzeViewModel analyze)
            : base("Cog", input, compare, analyze)
        {
            _dialogService      = dialogService;
            _importService      = importService;
            _exportService      = exportService;
            _imageExportService = imageExportService;
            _projectService     = projectService;
            _analysisService    = analysisService;

            _newCommand                              = new RelayCommand(New);
            _openCommand                             = new RelayCommand(Open);
            _saveCommand                             = new RelayCommand(Save, CanSave);
            _saveAsCommand                           = new RelayCommand(SaveAs);
            _importWordListsCommand                  = new RelayCommand(ImportWordLists);
            _importGeographicRegionsCommand          = new RelayCommand(ImportGeographicRegions);
            _exportWordListsCommand                  = new RelayCommand(ExportWordLists, CanExportWordLists);
            _exportSimilarityMatrixCommand           = new RelayCommand(ExportSimilarityMatrix, CanExportSimilarityMatrix);
            _exportCognateSetsCommand                = new RelayCommand(ExportCognateSets, CanExportCognateSets);
            _exportSegmentFrequenciesCommand         = new RelayCommand(ExportSegmentFrequencies, CanExportSegmentFrequencies);
            _exportHierarchicalGraphCommand          = new RelayCommand(ExportHierarchicalGraph, CanExportHierarchicalGraph);
            _exportNetworkGraphCommand               = new RelayCommand(ExportNetworkGraph, CanExportNetworkGraph);
            _exportGlobalCorrespondencesChartCommand = new RelayCommand(ExportGlobalCorrespondencesChart, CanExportGlobalCorrespondencesChart);
            _performComparisonCommand                = new RelayCommand(PerformComparison, CanPerformComparison);
            _runStemmerCommand                       = new RelayCommand(RunStemmer, CanRunStemmer);
            _aboutCommand                            = new RelayCommand(ShowAbout);

            foreach (ContainerViewModelBase childView in Views.OfType <ContainerViewModelBase>())
            {
                childView.PropertyChanging += childView_PropertyChanging;
            }

            PropertyChanging += OnPropertyChanging;

            _nullCommand = new RelayCommand(() => {}, () => false);
            _findCommand = _nullCommand;
            Messenger.Default.Register <SwitchViewMessage>(this, HandleSwitchView);
            Messenger.Default.Register <HookFindMessage>(this, msg => FindCommand = msg.FindCommand ?? _nullCommand);
        }