Exemple #1
0
        public DictionaryEditorViewModel(SpellChecker spellChecker)
        {
            _properties      = spellChecker.Properties;
            _affixDictionary = spellChecker.GetAffixes().ToDictionary(a => a.Key, a => a.Value);

            Patterns = new ObservableCollection <PatternViewModel>(
                spellChecker.GetPatterns()
                .Select(p => new PatternViewModel(this, p, _affixDictionary))
                );
            Affixes = new ObservableCollection <Affix>(spellChecker.GetAffixes().Values);

            RemovePatternCommand = new DelegateCommand(p =>
            {
                var pattern = p as PatternViewModel;
                if (pattern is null)
                {
                    return;
                }

                Patterns.Remove(pattern);
                FixPatternNumbers();
            });

            FixPatternNumbers();
        }