示例#1
0
        private void InitializeGetParentControlsEvents()
        {
            TextboxPrincipal.TextChanged += (sender, e) =>
            {
                //PopupPrincipal.IsOpen = false;
                try
                {
                    Text = TextboxPrincipal.Text;
                    var funcFilter = funcFilterFactory.GetFuncFilter(FilterClass, IsKeySensitive);

                    var text = Text;
                    var numberSugerencyElements = NumberSugerencyElements;
                    var fieldsSugerenciesSearch = FieldsSugerenciesSearch;

                    Action action = () => supportFiltersSearch.PopulateSubResults(text, funcFilter, numberSugerencyElements, fieldsSugerenciesSearch, IsDebugMode);
                    taskPool.AddAction(action);
                }
                catch (Exception ex)
                {
                    PopupPrincipal.IsOpen = false;

                    throw ex;
                }
            };

            TextboxPrincipal.GotFocus += (sender, e) =>
            {
                PopupPrincipal.IsOpen = true;
                TextboxSearch.Focus();
            };

            TextboxSearch.KeyDown += (sender, e) =>
            {
                if (e.Key == Key.Escape)
                {
                    TextboxPrincipal.Text = string.Empty;
                    PopupPrincipal.IsOpen = false;
                    IsSearched            = false;
                }

                if (e.Key == Key.Return)
                {
                    //PopupPrincipal.IsOpen = false;

                    if (Text == string.Empty)
                    {
                        ResetSearch();
                    }
                    else
                    {
                        FilterPrincipal();
                    }
                }
            };

            CloseButtonPopUp.Click += (sender, e) => PopupPrincipal.IsOpen = false;
        }
        public void GetFuncFilter_Custom_NotOK()
        {
            instance        = new FuncFilterFactory();
            instance.Custom = (a, b) => a.ToString()[1] == b.ToString()[1];

            object str1 = "abc";
            object str2 = "Ass";

            var result = instance.GetFuncFilter(FilterType.Custom, isKeySensitive: false);

            bool resultFunc = result(str1, str2);

            Assert.IsFalse(resultFunc);
        }
        public void GetFuncFilter_StarWithIsKeySensitive_OK()
        {
            object str1 = "aaa";
            object str2 = "A";

            var result = instance.GetFuncFilter(FilterType.StarWith, isKeySensitive: true);

            bool resultFunc = result(str1, str2);

            Assert.IsFalse(resultFunc);
        }