Example #1
0
        private void OnAddPattern_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            LogController.Log($"添加正则表达式-呼出popup");
            AddPatternCommandParameters parameters = e.Parameter as AddPatternCommandParameters;

            _Model.PopupRegexPattern = parameters.RegexText;
            _Model.PopupRegexType    = parameters.RegexType;
            _Model.PopupTime         = DateTime.Now.ToString();
            _Model.PopupIntro        = null;
            ManagePopup.IsOpen       = false;
            ManagePopup.IsOpen       = true;
        }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            AddPatternCommandParameters parameters = new AddPatternCommandParameters();

            if (values.Length == 2)
            {
                parameters.RegexText = values[0] as string;
                parameters.RegexType = values[1] as string;
            }

            return(parameters);
        }
Example #3
0
        private void OnAddPattern_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = false;
            AddPatternCommandParameters parameters = e.Parameter as AddPatternCommandParameters;

            if (parameters != null)
            {
                if (parameters.RegexText != null && !_Model.PatternExist(parameters.RegexText) && parameters.RegexText != "")
                {
                    e.CanExecute = true;
                }
            }
        }