コード例 #1
0
 public SegmentsVarietyViewModel(SegmentsViewModel segmentsViewModel, Variety variety)
     : base(variety)
 {
     _segments = new MirroredBindableList <Segment, VarietySegmentViewModel>(segmentsViewModel.DomainSegments,
                                                                             segment => new VarietySegmentViewModel(this, segment, segmentsViewModel.DomainSyllablePosition), viewModel => viewModel.DomainSegment);
     _switchToVarietyCommand = new RelayCommand(() => Messenger.Default.Send(new SwitchViewMessage(typeof(VarietiesViewModel), DomainVariety)));
 }
コード例 #2
0
ファイル: SegmentsVarietyViewModel.cs プロジェクト: rmunn/cog
 public SegmentsVarietyViewModel(SegmentsViewModel segmentsViewModel, Variety variety)
     : base(variety)
 {
     _segments = new MirroredBindableList<Segment, VarietySegmentViewModel>(segmentsViewModel.DomainSegments,
         segment => new VarietySegmentViewModel(this, segment, segmentsViewModel.DomainSyllablePosition), viewModel => viewModel.DomainSegment);
     _switchToVarietyCommand = new RelayCommand(() => Messenger.Default.Send(new SwitchViewMessage(typeof(VarietiesViewModel), DomainVariety)));
 }
コード例 #3
0
        public WordListsVarietyMeaningViewModel(IBusyService busyService, IAnalysisService analysisService, WordViewModel.Factory wordFactory, WordListsVarietyViewModel variety, Meaning meaning)
            : base(meaning)
        {
            _busyService     = busyService;
            _analysisService = analysisService;
            _variety         = variety;

            _domainWords = new ObservableList <Word>(variety.DomainVariety.Words[meaning]);
            _words       = new MirroredBindableList <Word, WordViewModel>(_domainWords, word => wordFactory(word), vm => vm.DomainWord);
            _domainWords.CollectionChanged += DomainWordsChanged;
            _strRep = string.Join(",", _domainWords.Select(word => word.StrRep));
            _showInVarietiesCommand = new RelayCommand(ShowInVarieties, () => _domainWords.Count > 0);
        }
コード例 #4
0
        public WordListsVarietyMeaningViewModel(IBusyService busyService, IAnalysisService analysisService, WordViewModel.Factory wordFactory, WordListsVarietyViewModel variety, Meaning meaning)
            : base(meaning)
        {
            _busyService = busyService;
            _analysisService = analysisService;
            _variety = variety;

            _domainWords = new ObservableList<Word>(variety.DomainVariety.Words[meaning]);
            _words = new MirroredBindableList<Word, WordViewModel>(_domainWords, word => wordFactory(word), vm => vm.DomainWord);
            _domainWords.CollectionChanged += DomainWordsChanged;
            _strRep = string.Join(",", _domainWords.Select(word => word.StrRep));
            _showInVarietiesCommand = new RelayCommand(ShowInVarieties, () => _domainWords.Count > 0);
        }
コード例 #5
0
        public VarietiesVarietyViewModel(IProjectService projectService, IDialogService dialogService, WordsViewModel.Factory wordsFactory, WordViewModel.Factory wordFactory, Variety variety)
            : base(variety)
        {
            _projectService = projectService;
            _dialogService = dialogService;

            IEnumerable<Segment> segments = variety.SegmentFrequencyDistribution == null ? Enumerable.Empty<Segment>() : variety.SegmentFrequencyDistribution.ObservedSamples;

            _segments = new BulkObservableList<VarietySegmentViewModel>(segments.Select(seg => new VarietySegmentViewModel(this, seg)));
            _maxSegProb = _segments.Select(seg => seg.Probability).Concat(0).Max();
            _readOnlySegments = new ReadOnlyBindableList<VarietySegmentViewModel>(_segments);
            variety.PropertyChanged += variety_PropertyChanged;
            _affixes = new MirroredBindableList<Affix, AffixViewModel>(DomainVariety.Affixes, affix => new AffixViewModel(affix), vm => vm.DomainAffix);
            _words = new MirroredBindableCollection<Word, WordViewModel>(variety.Words, word =>
                {
                    WordViewModel vm = wordFactory(word);
                    SelectWordSegments(vm);
                    return vm;
                }, vm => vm.DomainWord);
            _wordsViewModel = wordsFactory(_words);
            _newAffixCommand = new RelayCommand(NewAffix);
            _editAffixCommand = new RelayCommand(EditAffix, CanEditAffix);
            _removeAffixCommand = new RelayCommand(RemoveAffix, CanRemoveAffix);
        }
コード例 #6
0
        public VarietiesVarietyViewModel(IProjectService projectService, IDialogService dialogService, WordsViewModel.Factory wordsFactory, WordViewModel.Factory wordFactory, Variety variety)
            : base(variety)
        {
            _projectService = projectService;
            _dialogService  = dialogService;

            IEnumerable <Segment> segments = variety.SegmentFrequencyDistribution == null?Enumerable.Empty <Segment>() : variety.SegmentFrequencyDistribution.ObservedSamples;

            _segments                = new BulkObservableList <VarietySegmentViewModel>(segments.Select(seg => new VarietySegmentViewModel(this, seg)));
            _maxSegProb              = _segments.Select(seg => seg.Probability).Concat(0).Max();
            _readOnlySegments        = new ReadOnlyBindableList <VarietySegmentViewModel>(_segments);
            variety.PropertyChanged += variety_PropertyChanged;
            _affixes = new MirroredBindableList <Affix, AffixViewModel>(DomainVariety.Affixes, affix => new AffixViewModel(affix), vm => vm.DomainAffix);
            _words   = new MirroredBindableCollection <Word, WordViewModel>(variety.Words, word =>
            {
                WordViewModel vm = wordFactory(word);
                SelectWordSegments(vm);
                return(vm);
            }, vm => vm.DomainWord);
            _wordsViewModel     = wordsFactory(_words);
            _newAffixCommand    = new RelayCommand(NewAffix);
            _editAffixCommand   = new RelayCommand(EditAffix, CanEditAffix);
            _removeAffixCommand = new RelayCommand(RemoveAffix, CanRemoveAffix);
        }
コード例 #7
0
 public GeographicalVarietyViewModel(GeographicalRegionViewModel.Factory regionFactory, Variety variety)
     : base(variety)
 {
     _regions      = new MirroredBindableList <GeographicRegion, GeographicalRegionViewModel>(variety.Regions, region => regionFactory(this, region), vm => vm.DomainRegion);
     _clusterIndex = -1;
 }
コード例 #8
0
 public GeographicalVarietyViewModel(GeographicalRegionViewModel.Factory regionFactory, Variety variety)
     : base(variety)
 {
     _regions = new MirroredBindableList<GeographicRegion, GeographicalRegionViewModel>(variety.Regions, region => regionFactory(this, region), vm => vm.DomainRegion);
     _clusterIndex = -1;
 }