예제 #1
0
        //--------------------------------------------------------------------------------------------------
        // Для ключа propertyName удаляет все ошибки из словаря errors.
        void DelErrors([CallerMemberName] string propertyName = null)
        {
            if (errors.ContainsKey(propertyName))
            {
                Errors.Remove(propertyName);
            }
            OnPropertyChanged("Errors");

            if (propertyName == "SelectedWordExpression" || propertyName == "SelectedWordTrans")
            {
                SaveWord.ChangeCanExecute();
            }
            if (propertyName == "SelectedWordExpression")
            {
                OnPropertyChanged("SelectedWordExpressionHasErrors");
            }
            if (propertyName == "SelectedWordTrans")
            {
                OnPropertyChanged("SelectedWordTransHasErrors");
            }

            if (propertyName == "SelectedSamplePhrase" || propertyName == "SelectedSampleTrans")
            {
                SaveSample.ChangeCanExecute();
            }
            if (propertyName == "SelectedSamplePhrase")
            {
                OnPropertyChanged("SelectedSamplePhraseHasErrors");
            }
            if (propertyName == "SelectedSampleTrans")
            {
                OnPropertyChanged("SelectedSampleTransHasErrors");
            }
        }
예제 #2
0
        //--------------------------------------------------------------------------------------------------
        // В словарь errors добавляет по ключу propertyName ошибку со строкой errorString.
        void AddError(string errorString, [CallerMemberName] string propertyName = null)
        {
            ObservableCollection <string> err;

            if (errors.TryGetValue(propertyName, out err))
            {
                err.Add(errorString);
            }
            else
            {
                Errors.Add(propertyName, new ObservableCollection <string> {
                    errorString
                });
            }
            OnPropertyChanged("Errors");

            if (propertyName == "SelectedWordExpression" || propertyName == "SelectedWordTrans")
            {
                SaveWord.ChangeCanExecute();
            }
            if (propertyName == "SelectedWordExpression")
            {
                OnPropertyChanged("SelectedWordExpressionHasErrors");
            }
            if (propertyName == "SelectedWordTrans")
            {
                OnPropertyChanged("SelectedWordTransHasErrors");
            }

            if (propertyName == "SelectedSamplePhrase" || propertyName == "SelectedSampleTrans")
            {
                SaveSample.ChangeCanExecute();
            }
            if (propertyName == "SelectedSamplePhrase")
            {
                OnPropertyChanged("SelectedSamplePhraseHasErrors");
            }
            if (propertyName == "SelectedSampleTrans")
            {
                OnPropertyChanged("SelectedSampleTransHasErrors");
            }
        }