Exemple #1
0
        public GeographicalViewModel(IProjectService projectService, IDialogService dialogService, IImportService importService, IImageExportService imageExportService,
			GeographicalVarietyViewModel.Factory varietyFactory)
            : base("Geographical")
        {
            _projectService = projectService;
            _dialogService = dialogService;
            _importService = importService;
            _imageExportService = imageExportService;
            _varietyFactory = varietyFactory;

            _newRegionCommand = new RelayCommand<IEnumerable<Tuple<double, double>>>(AddNewRegion);
            _currentClusters = new List<Cluster<Variety>>();

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register<ComparisonPerformedMessage>(this, msg => ClusterVarieties());
            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
                {
                    if (msg.AffectsComparison)
                        ResetClusters();
                    if (_selectedRegion != null && (!_varieties.Contains(_selectedRegion.Variety) || !_selectedRegion.Variety.Regions.Contains(_selectedRegion)))
                        SelectedRegion = null;
                });
            Messenger.Default.Register<PerformingComparisonMessage>(this, msg => ResetClusters());

            _similarityScoreThreshold = 0.7;

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Similarity metric",
                new TaskAreaCommandViewModel("Lexical", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Lexical)),
                new TaskAreaCommandViewModel("Phonetic", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Phonetic))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Import regions", new RelayCommand(ImportRegions)),
                new TaskAreaCommandViewModel("Export this map", new RelayCommand(Export))));
        }
Exemple #2
0
        public GeographicalViewModel(IProjectService projectService, IDialogService dialogService, IImportService importService, IImageExportService imageExportService,
                                     GeographicalVarietyViewModel.Factory varietyFactory)
            : base("Geographical")
        {
            _projectService     = projectService;
            _dialogService      = dialogService;
            _importService      = importService;
            _imageExportService = imageExportService;
            _varietyFactory     = varietyFactory;

            _newRegionCommand = new RelayCommand <IEnumerable <Tuple <double, double> > >(AddNewRegion);
            _currentClusters  = new List <Cluster <Variety> >();

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => ClusterVarieties());
            Messenger.Default.Register <DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                {
                    ResetClusters();
                }
                if (_selectedRegion != null && (!_varieties.Contains(_selectedRegion.Variety) || !_selectedRegion.Variety.Regions.Contains(_selectedRegion)))
                {
                    SelectedRegion = null;
                }
            });
            Messenger.Default.Register <PerformingComparisonMessage>(this, msg => ResetClusters());

            _similarityScoreThreshold = 0.7;

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Similarity metric",
                                                            new TaskAreaCommandViewModel("Lexical", new RelayCommand(() => SimilarityMetric  = SimilarityMetric.Lexical)),
                                                            new TaskAreaCommandViewModel("Phonetic", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Phonetic))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                                                     new TaskAreaCommandViewModel("Import regions", new RelayCommand(ImportRegions)),
                                                     new TaskAreaCommandViewModel("Export map", new RelayCommand(Export))));
        }