public NetworkGraphViewModel(IProjectService projectService, IImageExportService imageExportService, IGraphService graphService) : base("Network Graph") { _projectService = projectService; _imageExportService = imageExportService; _graphService = graphService; _projectService.ProjectOpened += _projectService_ProjectOpened; Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => Graph = _graphService.GenerateNetworkGraph(_similarityMetric)); Messenger.Default.Register <DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) { Graph = null; } }); Messenger.Default.Register <PerformingComparisonMessage>(this, msg => Graph = null); 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("Export this graph", new RelayCommand(Export)))); _similarityScoreFilter = 0.7; }
public SimilarityMatrixViewModel(IProjectService projectService, IExportService exportService, IAnalysisService analysisService) : base("Similarity Matrix") { _projectService = projectService; _exportService = exportService; _analysisService = analysisService; _modelVarieties = new List <Variety>(); _projectService.ProjectOpened += _projectService_ProjectOpened; Messenger.Default.Register <DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) { ResetVarieties(); } }); Messenger.Default.Register <PerformingComparisonMessage>(this, msg => ResetVarieties()); Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => CreateSimilarityMatrix()); 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("Common tasks", new TaskAreaCommandViewModel("Compare all variety pairs", new RelayCommand(PerformComparison)))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export matrix", new RelayCommand(Export, CanExport)))); _performComparisonCommand = new RelayCommand(PerformComparison); }
public WordListsViewModel(IProjectService projectService, IDialogService dialogService, IImportService importService, IExportService exportService, IAnalysisService analysisService, WordListsVarietyViewModel.Factory varietyFactory) : base("Word lists") { _projectService = projectService; _dialogService = dialogService; _importService = importService; _exportService = exportService; _analysisService = analysisService; _varietyFactory = varietyFactory; Messenger.Default.Register <SwitchViewMessage>(this, HandleSwitchView); Messenger.Default.Register <DomainModelChangedMessage>(this, HandleDomainModelChanged); _projectService.ProjectOpened += _projectService_ProjectOpened; _findCommand = new RelayCommand(Find); TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Add a new variety", new RelayCommand(AddNewVariety)), new TaskAreaCommandViewModel("Add a new meaning", new RelayCommand(AddNewMeaning)), new TaskAreaCommandViewModel("Find words", _findCommand), new TaskAreaCommandViewModel("Import word lists from file", new RelayCommand(ImportFromFile)), new TaskAreaCommandViewModel("Import word lists from clipboard", new RelayCommand(ImportFromClipboard, CanImportFromClipboard)))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export word lists", new RelayCommand(Export, CanExport)), new TaskAreaCommandViewModel("Remove affixes from words in all varieties", new RelayCommand(RunStemmer, CanRunStemmer)))); AddNewVarietyCommand = new RelayCommand(AddNewVariety); AddNewMeaningCommand = new RelayCommand(AddNewMeaning); ImportWordListsCommand = new RelayCommand(ImportFromFile); ShowGettingStartedCommand = new RelayCommand(ShowGettingStarted); _isEmpty = true; }
public VarietiesViewModel(IProjectService projectService, IDialogService dialogService, IAnalysisService analysisService, VarietiesVarietyViewModel.Factory varietyFactory) : base("Varieties") { _projectService = projectService; _dialogService = dialogService; _analysisService = analysisService; _varietyFactory = varietyFactory; _projectService.ProjectOpened += _projectService_ProjectOpened; _sortPropertyName = "Meaning.Gloss"; _sortDirection = ListSortDirection.Ascending; Messenger.Default.Register <SwitchViewMessage>(this, HandleSwitchView); _findCommand = new RelayCommand(Find); TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Add a new variety", new RelayCommand(AddNewVariety)), new TaskAreaCommandViewModel("Rename variety", new RelayCommand(RenameSelectedVariety, CanRenameSelectedVariety)), new TaskAreaCommandViewModel("Remove variety", new RelayCommand(RemoveSelectedVariety, CanRemoveSelectedVariety)), new TaskAreaCommandViewModel("Find words", _findCommand), new TaskAreaItemsViewModel("Sort words by", new TaskAreaCommandGroupViewModel( new TaskAreaCommandViewModel("Gloss", new RelayCommand(() => SortWordsBy("Meaning.Gloss", ListSortDirection.Ascending))), new TaskAreaCommandViewModel("Form", new RelayCommand(() => SortWordsBy("StrRep", ListSortDirection.Ascending))))))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Remove affixes from words", new RelayCommand(RunStemmer, CanRunStemmer)))); }
public WordListsViewModel(IProjectService projectService, IDialogService dialogService, IImportService importService, IExportService exportService, IAnalysisService analysisService, WordListsVarietyViewModel.Factory varietyFactory) : base("Word lists") { _projectService = projectService; _dialogService = dialogService; _importService = importService; _exportService = exportService; _analysisService = analysisService; _varietyFactory = varietyFactory; Messenger.Default.Register <SwitchViewMessage>(this, HandleSwitchView); _projectService.ProjectOpened += _projectService_ProjectOpened; _findCommand = new RelayCommand(Find); TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Add a new variety", new RelayCommand(AddNewVariety)), new TaskAreaCommandViewModel("Add a new meaning", new RelayCommand(AddNewMeaning)), new TaskAreaCommandViewModel("Find words", _findCommand), new TaskAreaCommandViewModel("Import word lists", new RelayCommand(Import)))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export word lists", new RelayCommand(Export)), new TaskAreaCommandViewModel("Remove affixes from all words", new RelayCommand(RunStemmer)))); _isEmpty = true; }
public HierarchicalGraphViewModel(IProjectService projectService, IImageExportService exportService, IGraphService graphService) : base("Hierarchical Graph") { _projectService = projectService; _exportService = exportService; _graphService = graphService; _projectService.ProjectOpened += _projectService_ProjectOpened; Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => Graph = _graphService.GenerateHierarchicalGraph(_graphType, _clusteringMethod, _similarityMetric)); Messenger.Default.Register <DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) { Graph = null; } }); Messenger.Default.Register <PerformingComparisonMessage>(this, msg => Graph = null); TaskAreas.Add(new TaskAreaCommandGroupViewModel("Graph type", new TaskAreaCommandViewModel("Dendrogram", new RelayCommand(() => GraphType = HierarchicalGraphType.Dendrogram)), new TaskAreaCommandViewModel("Tree", new RelayCommand(() => GraphType = HierarchicalGraphType.Tree)))); TaskAreas.Add(new TaskAreaCommandGroupViewModel("Clustering method", new TaskAreaCommandViewModel("UPGMA", new RelayCommand(() => ClusteringMethod = ClusteringMethod.Upgma)), new TaskAreaCommandViewModel("Neighbor-joining", new RelayCommand(() => ClusteringMethod = ClusteringMethod.NeighborJoining)))); 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("Export this graph", new RelayCommand(Export)))); _graphType = HierarchicalGraphType.Dendrogram; }
public VarietyPairsViewModel(IProjectService projectService, IBusyService busyService, IDialogService dialogService, IExportService exportService, IAnalysisService analysisService, VarietyPairViewModel.Factory varietyPairFactory) : base("Variety Pairs") { _projectService = projectService; _busyService = busyService; _dialogService = dialogService; _exportService = exportService; _analysisService = analysisService; _varietyPairFactory = varietyPairFactory; _projectService.ProjectOpened += _projectService_ProjectOpened; _sortPropertyName = "PhoneticSimilarityScore"; _sortDirection = ListSortDirection.Descending; Messenger.Default.Register <PerformingComparisonMessage>(this, msg => { if (msg.VarietyPair == null) { ClearComparison(); } }); Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => { if (msg.VarietyPair == null) { SetSelectedVarietyPair(); } }); Messenger.Default.Register <DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) { ClearComparison(); } }); Messenger.Default.Register <SwitchViewMessage>(this, HandleSwitchView); _findCommand = new RelayCommand(Find); _performComparisonCommand = new RelayCommand(PerformComparison); _selectedWordPairsMonitor = new SimpleMonitor(); _varietyPairState = VarietyPairState.NotSelected; TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Compare variety pair", new RelayCommand(PerformComparison, CanPerformComparison)), new TaskAreaCommandViewModel("Find words", _findCommand), new TaskAreaItemsViewModel("Sort word pairs by", new TaskAreaCommandGroupViewModel( new TaskAreaCommandViewModel("Similarity", new RelayCommand(() => SortWordPairsBy("PhoneticSimilarityScore", ListSortDirection.Descending))), new TaskAreaCommandViewModel("Gloss", new RelayCommand(() => SortWordPairsBy("Meaning.Gloss", ListSortDirection.Ascending))))))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export results for variety pair", new RelayCommand(ExportVarietyPair, CanExportVarietyPair)))); }
public MeaningsViewModel(IProjectService projectService, IDialogService dialogService) : base("Meanings") { _projectService = projectService; _dialogService = dialogService; _projectService.ProjectOpened += _projectService_ProjectOpened; TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Add a new meaning", new RelayCommand(AddNewMeaning)), new TaskAreaCommandViewModel("Edit selected meaning", new RelayCommand(EditSelectedMeaning)), new TaskAreaCommandViewModel("Remove selected meaning", new RelayCommand(RemoveSelectedMeaning)))); }
public GlobalCorrespondencesViewModel(IProjectService projectService, IBusyService busyService, IDialogService dialogService, IImageExportService imageExportService, IGraphService graphService, WordPairsViewModel.Factory wordPairsFactory, WordPairViewModel.Factory wordPairFactory) : base("Global Correspondences") { _projectService = projectService; _busyService = busyService; _dialogService = dialogService; _imageExportService = imageExportService; _graphService = graphService; _wordPairFactory = wordPairFactory; _selectedVarieties = new HashSet <Variety>(); _projectService.ProjectOpened += _projectService_ProjectOpened; Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => GenerateGraph()); Messenger.Default.Register <DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) { ClearGraph(); } }); Messenger.Default.Register <PerformingComparisonMessage>(this, msg => ClearGraph()); _findCommand = new RelayCommand(Find); TaskAreas.Add(new TaskAreaCommandGroupViewModel("Syllable position", new TaskAreaCommandViewModel("Onset", new RelayCommand(() => SyllablePosition = SyllablePosition.Onset)), new TaskAreaCommandViewModel("Nucleus", new RelayCommand(() => SyllablePosition = SyllablePosition.Nucleus)), new TaskAreaCommandViewModel("Coda", new RelayCommand(() => SyllablePosition = SyllablePosition.Coda)))); _correspondenceFilter = new TaskAreaIntegerViewModel("Frequency threshold"); _correspondenceFilter.PropertyChanging += _correspondenceFilter_PropertyChanging; _correspondenceFilter.PropertyChanged += _correspondenceFilter_PropertyChanged; TaskAreas.Add(_correspondenceFilter); TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Find words", _findCommand), new TaskAreaItemsViewModel("Sort word pairs by", new TaskAreaCommandGroupViewModel( new TaskAreaCommandViewModel("Gloss", new RelayCommand(() => _observedWordPairs.UpdateSort("Meaning.Gloss", ListSortDirection.Ascending))), new TaskAreaCommandViewModel("Similarity", new RelayCommand(() => _observedWordPairs.UpdateSort("PhoneticSimilarityScore", ListSortDirection.Descending))))), new TaskAreaCommandViewModel("Select varieties", new RelayCommand(SelectVarieties)) )); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export chart", new RelayCommand(ExportChart, CanExportChart)))); _observedWordPairs = wordPairsFactory(); _observedWordPairs.IncludeVarietyNamesInSelectedText = true; _observedWordPairs.UpdateSort("Meaning.Gloss", ListSortDirection.Ascending); }
public MeaningsViewModel(IProjectService projectService, IDialogService dialogService, IBusyService busyService) : base("Meanings") { _projectService = projectService; _dialogService = dialogService; _busyService = busyService; _projectService.ProjectOpened += _projectService_ProjectOpened; TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Add a new meaning", new RelayCommand(AddNewMeaning)), new TaskAreaCommandViewModel("Edit meaning", new RelayCommand(EditSelectedMeaning, CanEditSelectedMeaning)), new TaskAreaCommandViewModel("Remove meaning", new RelayCommand(RemoveSelectedMeaning, CanRemoveSelectedMeaning)))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Move meaning up", new RelayCommand(MoveSelectedMeaningUp, CanMoveSelectedMeaningUp)), new TaskAreaCommandViewModel("Move meaning down", new RelayCommand(MoveSelectedMeaningDown, CanMoveSelectedMeaningDown)))); }
public MultipleWordAlignmentViewModel(IProjectService projectService, IBusyService busyService, IExportService exportService, IAnalysisService analysisService) : base("Multiple Word Alignment") { _projectService = projectService; _busyService = busyService; _exportService = exportService; _analysisService = analysisService; _projectService.ProjectOpened += _projectService_ProjectOpened; var showCognateSets = new TaskAreaBooleanViewModel("Show cognate sets") { Value = true }; showCognateSets.PropertyChanged += _showCognateSets_PropertyChanged; TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaItemsViewModel("Sort words by", new TaskAreaCommandGroupViewModel( new TaskAreaCommandViewModel("Form", new RelayCommand(() => SortBy("StrRep", ListSortDirection.Ascending))), new TaskAreaCommandViewModel("Variety", new RelayCommand(() => SortBy("Variety", ListSortDirection.Ascending)))), showCognateSets))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export all cognate sets", new RelayCommand(ExportCognateSets, CanExportCognateSets)))); _words = new BindableList <MultipleWordAlignmentWordViewModel>(); _selectedWords = new BindableList <MultipleWordAlignmentWordViewModel>(); _showInVarietyPairsCommand = new RelayCommand(ShowInVarietyPairs, CanShowInVarietyPairs); _performComparisonCommand = new RelayCommand(PerformComparison); _groupByCognateSet = true; _sortByProp = "StrRep"; Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => AlignWords()); Messenger.Default.Register <DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) { ResetAlignment(); } }); Messenger.Default.Register <PerformingComparisonMessage>(this, msg => ResetAlignment()); Messenger.Default.Register <SwitchViewMessage>(this, HandleSwitchView); }
public SegmentsViewModel(IProjectService projectService, IDialogService dialogService, IBusyService busyService, IExportService exportService, WordsViewModel.Factory wordsFactory, WordViewModel.Factory wordFactory) : base("Segments") { _projectService = projectService; _busyService = busyService; _dialogService = dialogService; _exportService = exportService; _wordFactory = wordFactory; _findCommand = new RelayCommand(Find); TaskAreas.Add(new TaskAreaCommandGroupViewModel("Syllable position", new TaskAreaCommandViewModel("Onset", new RelayCommand(() => SyllablePosition = SyllablePosition.Onset)), new TaskAreaCommandViewModel("Nucleus", new RelayCommand(() => SyllablePosition = SyllablePosition.Nucleus)), new TaskAreaCommandViewModel("Coda", new RelayCommand(() => SyllablePosition = SyllablePosition.Coda)))); TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Find words", _findCommand), new TaskAreaItemsViewModel("Sort words by", new TaskAreaCommandGroupViewModel( new TaskAreaCommandViewModel("Meaning", new RelayCommand(() => SortWordsBy("Meaning.Gloss", ListSortDirection.Ascending))), new TaskAreaCommandViewModel("Form", new RelayCommand(() => SortWordsBy("StrRep", ListSortDirection.Ascending))))))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export segment frequencies", new RelayCommand(() => _exportService.ExportSegmentFrequencies(this, _syllablePosition))))); _projectService.ProjectOpened += _projectService_ProjectOpened; Messenger.Default.Register <DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) { PopulateSegments(); } }); _currentWords = new BulkObservableList <WordViewModel>(); _observedWords = wordsFactory(new ReadOnlyBindableList <WordViewModel>(_currentWords)); _domainSegments = new BulkObservableList <Segment>(); _segments = new BulkObservableList <SegmentViewModel>(); _readonlySegments = new ReadOnlyBindableList <SegmentViewModel>(_segments); _categories = new BulkObservableList <SegmentCategoryViewModel>(); _readonlyCategories = new ReadOnlyBindableList <SegmentCategoryViewModel>(_categories); }
protected SettingsWorkspaceViewModelBase(string title, IProjectService projectService, IBusyService busyService, params ComponentSettingsViewModelBase[] components) : base("Settings") { _title = title; _busyService = busyService; _applyCommand = new RelayCommand(Apply, CanApply); _resetCommand = new RelayCommand(Reset); TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Apply changes", _applyCommand), new TaskAreaCommandViewModel("Reset changes", _resetCommand))); projectService.ProjectOpened += projectService_ProjectOpened; _components = new ReadOnlyList <ComponentSettingsViewModelBase>(components); foreach (ComponentSettingsViewModelBase componentVM in _components) { componentVM.PropertyChanged += Component_PropertyChanged; } }
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)))); }