Inheritance: ChangeTrackingViewModelBase
コード例 #1
0
        public override void Setup()
        {
            var aligner  = (Aline)_projectService.Project.WordAligners[ComponentIdentifiers.PrimaryWordAligner];
            var features = new List <RelevantFeatureViewModel>();

            foreach (KeyValuePair <SymbolicFeature, int> kvp in aligner.FeatureWeights)
            {
                var vm = new RelevantFeatureViewModel(kvp.Key, kvp.Value, aligner.RelevantVowelFeatures.Contains(kvp.Key), aligner.RelevantConsonantFeatures.Contains(kvp.Key), aligner.ValueMetrics);
                vm.PropertyChanged += ChildPropertyChanged;
                features.Add(vm);
            }
            Set(() => Features, ref _features, new ReadOnlyList <RelevantFeatureViewModel>(features));
            switch (aligner.Settings.Mode)
            {
            case AlignmentMode.Local:
                Set(() => Mode, ref _mode, AlineMode.Local);
                break;

            case AlignmentMode.Global:
                Set(() => Mode, ref _mode, AlineMode.Global);
                break;

            case AlignmentMode.SemiGlobal:
                Set(() => Mode, ref _mode, AlineMode.SemiGlobal);
                break;

            case AlignmentMode.HalfLocal:
                Set(() => Mode, ref _mode, AlineMode.HalfLocal);
                break;
            }
            Set(() => ExpansionCompressionEnabled, ref _expansionCompressionEnabled, aligner.Settings.ExpansionCompressionEnabled);
            Set(() => SoundChangeScoringEnabled, ref _soundChangeScoringEnabled, aligner.Settings.SoundChangeScoringEnabled);
            Set(() => SyllablePositionCostEnabled, ref _syllablePositionCostEnabled, aligner.Settings.SyllablePositionCostEnabled);

            _soundClasses.SelectedSoundClass = null;
            _soundClasses.SoundClasses.Clear();
            foreach (SoundClass soundClass in aligner.ContextualSoundClasses)
            {
                _soundClasses.SoundClasses.Add(new SoundClassViewModel(soundClass));
            }
        }
コード例 #2
0
        public override void Setup()
        {
            _soundClasses.SelectedSoundClass = null;
            _soundClasses.SoundClasses.Clear();

            IWordAligner aligner = _projectService.Project.WordAligners[ComponentIdentifiers.PrimaryWordAligner];
            var sca = aligner as SCAAlign;
            if (sca == null)
            {
                Set(() => Features, ref _features, null);
            }
            else
            {
                var features = new List<RelevantFeatureViewModel>();
                foreach (KeyValuePair<SymbolicFeature, int> kvp in sca.FeatureWeights)
                {
                    var vm = new RelevantFeatureViewModel(kvp.Key, kvp.Value, sca.RelevantVowelFeatures.Contains(kvp.Key), sca.RelevantConsonantFeatures.Contains(kvp.Key), sca.ValueMetrics);
                    vm.PropertyChanged += ChildPropertyChanged;
                    features.Add(vm);
                }
                Set(() => Features, ref _features, new ReadOnlyList<RelevantFeatureViewModel>(features));
                switch (sca.Settings.Mode)
                {
                    case AlignmentMode.Local:
                        Set(() => Mode, ref _mode, SCAAlignMode.Local);
                        break;
                    case AlignmentMode.Global:
                        Set(() => Mode, ref _mode, SCAAlignMode.Global);
                        break;
                    case AlignmentMode.SemiGlobal:
                        Set(() => Mode, ref _mode, SCAAlignMode.SemiGlobal);
                        break;
                    case AlignmentMode.HalfLocal:
                        Set(() => Mode, ref _mode, SCAAlignMode.HalfLocal);
                        break;
                }

                foreach (SoundClass soundClass in sca.ContextualSoundClasses)
                    _soundClasses.SoundClasses.Add(new SoundClassViewModel(soundClass));
            }
        }
コード例 #3
0
ファイル: AlineViewModel.cs プロジェクト: rmunn/cog
        public override void Setup()
        {
            var aligner = (Aline) _projectService.Project.WordAligners[ComponentIdentifiers.PrimaryWordAligner];
            var features = new List<RelevantFeatureViewModel>();
            foreach (KeyValuePair<SymbolicFeature, int> kvp in aligner.FeatureWeights)
            {
                var vm = new RelevantFeatureViewModel(kvp.Key, kvp.Value, aligner.RelevantVowelFeatures.Contains(kvp.Key), aligner.RelevantConsonantFeatures.Contains(kvp.Key), aligner.ValueMetrics);
                vm.PropertyChanged += ChildPropertyChanged;
                features.Add(vm);
            }
            Set(() => Features, ref _features, new ReadOnlyList<RelevantFeatureViewModel>(features));
            switch (aligner.Settings.Mode)
            {
                case AlignmentMode.Local:
                    Set(() => Mode, ref _mode, AlineMode.Local);
                    break;
                case AlignmentMode.Global:
                    Set(() => Mode, ref _mode, AlineMode.Global);
                    break;
                case AlignmentMode.SemiGlobal:
                    Set(() => Mode, ref _mode, AlineMode.SemiGlobal);
                    break;
                case AlignmentMode.HalfLocal:
                    Set(() => Mode, ref _mode, AlineMode.HalfLocal);
                    break;
            }
            Set(() => ExpansionCompressionEnabled, ref _expansionCompressionEnabled, aligner.Settings.ExpansionCompressionEnabled);
            Set(() => SoundChangeScoringEnabled, ref _soundChangeScoringEnabled, aligner.Settings.SoundChangeScoringEnabled);
            Set(() => SyllablePositionCostEnabled, ref _syllablePositionCostEnabled, aligner.Settings.SyllablePositionCostEnabled);

            _soundClasses.SelectedSoundClass = null;
            _soundClasses.SoundClasses.Clear();
            foreach (SoundClass soundClass in aligner.ContextualSoundClasses)
                _soundClasses.SoundClasses.Add(new SoundClassViewModel(soundClass));
        }