Example #1
0
 private void MeaningsChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (_selectedMeaning == null || !_meanings.Contains(_selectedMeaning))
     {
         SelectedMeaning = _meanings.Count > 0 ? _meanings[0] : null;
     }
 }
Example #2
0
 private void MeaningsChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (_selectedMeaning == null || !_meanings.Contains(_selectedMeaning))
     {
         SelectedMeaning = _meanings.Count > 0 ? _meaningsView.Cast <MeaningViewModel>().First() : null;
     }
 }
Example #3
0
 private void VarietiesChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (_selectedVariety == null || !_varieties.Contains(_selectedVariety))
     {
         SelectedVariety = _varieties.Count > 0 ? _varietiesView.Cast <VarietiesVarietyViewModel>().First() : null;
     }
 }
Example #4
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))));
        }