SetValid() публичный Метод

public SetValid ( bool isValid ) : void
isValid bool
Результат void
Пример #1
0
        private void HeapFilter_FilterChanging(object sender, FilterChangingEventArgs args)
        {
            if (args.Filter.Trim().Length == 0)
            {
                return;
            }

            var   filter = EscapeFilter(args.Filter);
            Regex regex;

            try {
                regex = new Regex(filter);
            } catch {
                args.SetValid(false);
                return;
            }

            foreach (var name in KnownFunctionNames)
            {
                if (regex.IsMatch(name))
                {
                    args.SetValid(true);
                    return;
                }
            }

            args.SetValid(false);
        }
Пример #2
0
        private void TracebackFilter_FilterChanging(object sender, FilterChangingEventArgs e)
        {
            if (e.Filter.Trim().Length == 0)
            {
                return;
            }

            var   filter = MainWindow.EscapeFilter(e.Filter);
            Regex regex;

            try {
                regex = new Regex(filter);
            } catch {
                e.SetValid(false);
                return;
            }

            foreach (var name in FunctionNames)
            {
                if (regex.IsMatch(name))
                {
                    e.SetValid(true);
                    return;
                }
            }

            e.SetValid(false);
        }
Пример #3
0
        private void FilterText_TextChanged(object sender, EventArgs e)
        {
            if (FilterText.Text != _Filter)
            {
                if (FilterText.Text.Trim().Length == 0)
                {
                    if (SystemColors.Window != FilterText.BackColor)
                    {
                        FilterText.BackColor = SystemColors.Window;
                    }

                    _Filter = null;

                    if (FilterChanged != null)
                    {
                        FilterChanged(this, EventArgs.Empty);
                    }

                    return;
                }

                var ea = new FilterChangingEventArgs(FilterText.Text);

                if (FilterChanging != null)
                {
                    FilterChanging(this, ea);
                }
                else
                {
                    ea.SetValid(true);
                }

                var newColor =
                    (ea.IsValid.HasValue) ?
                    ((ea.IsValid.GetValueOrDefault(false)) ?
                     Color.LightGoldenrodYellow : Color.LightPink)
                        : SystemColors.Window;

                if (newColor != FilterText.BackColor)
                {
                    FilterText.BackColor = newColor;
                }

                if (ea.IsValid.GetValueOrDefault(false))
                {
                    _Filter = FilterText.Text;
                }
                else
                {
                    _Filter = null;
                }

                if (FilterChanged != null)
                {
                    FilterChanged(this, EventArgs.Empty);
                }
            }
        }
Пример #4
0
        private void TracebackFilter_FilterChanging(object sender, FilterChangingEventArgs e)
        {
            if (e.Filter.Trim().Length == 0)
                return;

            Regex regex;
            try {
                regex = MainWindow.FilterToRegex(e.Filter);
            } catch {
                e.SetValid(false);
                return;
            }

            foreach (var name in FunctionNames) {
                if (regex.IsMatch(name)) {
                    e.SetValid(true);
                    return;
                }
            }

            e.SetValid(false);
        }
Пример #5
0
        private void FilterText_TextChanged(object sender, EventArgs e)
        {
            if (FilterText.Text != _Filter) {
                if (FilterText.Text.Trim().Length == 0) {
                    if (SystemColors.Window != FilterText.BackColor)
                        FilterText.BackColor = SystemColors.Window;

                    _Filter = null;

                    if (FilterChanged != null)
                        FilterChanged(this, EventArgs.Empty);

                    return;
                }

                var ea = new FilterChangingEventArgs(FilterText.Text);

                if (FilterChanging != null)
                    FilterChanging(this, ea);
                else
                    ea.SetValid(true);

                var newColor =
                    (ea.IsValid.HasValue) ?
                        ((ea.IsValid.GetValueOrDefault(false)) ?
                            Color.LightGoldenrodYellow : Color.LightPink)
                        : SystemColors.Window;

                if (newColor != FilterText.BackColor)
                    FilterText.BackColor = newColor;

                if (ea.IsValid.GetValueOrDefault(false))
                    _Filter = FilterText.Text;
                else
                    _Filter = null;

                if (FilterChanged != null)
                    FilterChanged(this, EventArgs.Empty);
            }
        }
Пример #6
0
        private void HeapFilter_FilterChanging(object sender, FilterChangingEventArgs args)
        {
            if (args.Filter.Trim().Length == 0)
                return;

            Regex regex;
            try {
                regex = FilterToRegex(args.Filter);
            } catch {
                args.SetValid(false);
                return;
            }

            foreach (var name in KnownFunctionNames) {
                if (regex.IsMatch(name)) {
                    args.SetValid(true);
                    return;
                }
            }

            args.SetValid(false);
        }