Esempio n. 1
0
        private void NewNaturalClass()
        {
            var vm = new EditNaturalClassViewModel(_projectService.Project.FeatureSystem, _soundClasses.Select(nc => nc.DomainSoundClass));

            if (_dialogService.ShowModalDialog(this, vm) == true)
            {
                var fs = new FeatureStruct();
                fs.AddValue(CogFeatureSystem.Type, vm.Type == SoundType.Consonant ? CogFeatureSystem.ConsonantType : CogFeatureSystem.VowelType);
                foreach (FeatureViewModel feature in vm.ActiveFeatures)
                {
                    fs.AddValue(feature.DomainFeature, feature.SelectedValue.DomainSymbol);
                }
                var newNaturalClass = new SoundClassViewModel(new NaturalClass(vm.Name, fs), _displaySonority ? 0 : -1);
                IsChanged = true;
                _soundClasses.Add(newNaturalClass);
                SelectedSoundClass = newNaturalClass;
            }
        }
Esempio n. 2
0
        private void EditSoundClass()
        {
            var currentNC = _selectedSoundClass.DomainSoundClass as NaturalClass;

            if (currentNC != null)
            {
                var vm = new EditNaturalClassViewModel(_projectService.Project.FeatureSystem, _soundClasses.Select(nc => nc.DomainSoundClass), currentNC);
                if (_dialogService.ShowModalDialog(this, vm) == true)
                {
                    var fs = new FeatureStruct();
                    fs.AddValue(CogFeatureSystem.Type, vm.Type == SoundType.Consonant ? CogFeatureSystem.ConsonantType : CogFeatureSystem.VowelType);
                    foreach (FeatureViewModel feature in vm.ActiveFeatures)
                    {
                        fs.AddValue(feature.DomainFeature, feature.SelectedValue.DomainSymbol);
                    }
                    var newNaturalClass = new SoundClassViewModel(new NaturalClass(vm.Name, fs), _selectedSoundClass.Sonority);
                    int index           = _soundClasses.IndexOf(_selectedSoundClass);
                    IsChanged            = true;
                    _soundClasses[index] = newNaturalClass;
                    SelectedSoundClass   = newNaturalClass;
                }
            }
            else
            {
                var currentUnc = _selectedSoundClass.DomainSoundClass as UnnaturalClass;
                if (currentUnc != null)
                {
                    var vm = new EditUnnaturalClassViewModel(_dialogService, _projectService.Project.Segmenter, _soundClasses.Select(nc => nc.DomainSoundClass), currentUnc);
                    if (_dialogService.ShowModalDialog(this, vm) == true)
                    {
                        var newUnnaturalClass = new SoundClassViewModel(new UnnaturalClass(vm.Name, vm.Segments, vm.IgnoreModifiers, _projectService.Project.Segmenter), _selectedSoundClass.Sonority);
                        int index             = _soundClasses.IndexOf(_selectedSoundClass);
                        IsChanged            = true;
                        _soundClasses[index] = newUnnaturalClass;
                        SelectedSoundClass   = newUnnaturalClass;
                    }
                }
            }
        }
Esempio n. 3
0
 private void NewNaturalClass()
 {
     var vm = new EditNaturalClassViewModel(_projectService.Project.FeatureSystem, _soundClasses.Select(nc => nc.DomainSoundClass));
     if (_dialogService.ShowModalDialog(this, vm) == true)
     {
         var fs = new FeatureStruct();
         fs.AddValue(CogFeatureSystem.Type, vm.Type == SoundType.Consonant ? CogFeatureSystem.ConsonantType : CogFeatureSystem.VowelType);
         foreach (FeatureViewModel feature in vm.ActiveFeatures)
             fs.AddValue(feature.DomainFeature, feature.SelectedValue.DomainSymbol);
         var newNaturalClass = new SoundClassViewModel(new NaturalClass(vm.Name, fs), _displaySonority ? 0 : -1);
         IsChanged = true;
         _soundClasses.Add(newNaturalClass);
         SelectedSoundClass = newNaturalClass;
     }
 }
Esempio n. 4
0
 private void EditSoundClass()
 {
     var currentNC = _selectedSoundClass.DomainSoundClass as NaturalClass;
     if (currentNC != null)
     {
         var vm = new EditNaturalClassViewModel(_projectService.Project.FeatureSystem, _soundClasses.Select(nc => nc.DomainSoundClass), currentNC);
         if (_dialogService.ShowModalDialog(this, vm) == true)
         {
             var fs = new FeatureStruct();
             fs.AddValue(CogFeatureSystem.Type, vm.Type == SoundType.Consonant ? CogFeatureSystem.ConsonantType : CogFeatureSystem.VowelType);
             foreach (FeatureViewModel feature in vm.ActiveFeatures)
                 fs.AddValue(feature.DomainFeature, feature.SelectedValue.DomainSymbol);
             var newNaturalClass = new SoundClassViewModel(new NaturalClass(vm.Name, fs), _selectedSoundClass.Sonority);
             int index = _soundClasses.IndexOf(_selectedSoundClass);
             IsChanged = true;
             _soundClasses[index] = newNaturalClass;
             SelectedSoundClass = newNaturalClass;
         }
     }
     else
     {
         var currentUnc = _selectedSoundClass.DomainSoundClass as UnnaturalClass;
         if (currentUnc != null)
         {
             var vm = new EditUnnaturalClassViewModel(_dialogService, _projectService.Project.Segmenter, _soundClasses.Select(nc => nc.DomainSoundClass), currentUnc);
             if (_dialogService.ShowModalDialog(this, vm) == true)
             {
                 var newUnnaturalClass = new SoundClassViewModel(new UnnaturalClass(vm.Name, vm.Segments, vm.IgnoreModifiers, _projectService.Project.Segmenter), _selectedSoundClass.Sonority);
                 int index = _soundClasses.IndexOf(_selectedSoundClass);
                 IsChanged = true;
                 _soundClasses[index] = newUnnaturalClass;
                 SelectedSoundClass = newUnnaturalClass;
             }
         }
     }
 }