Ejemplo n.º 1
0
        public SearchHints(ITradeService tradeService, UserInputThrottlingOcDispatcher throttling, OcDispatcher backgroundOcDispatcher, WpfOcDispatcher wpfOcDispatcher)
        {
            _searchTextThrottled =
                new Computing <string>(() => SearchText)
                .ScalarDispatching(throttling)
                .SetDefaultValue("")
                .For(_consumer);

            _searchTextThrottled.PreValueChanged += (sender, args) =>
                                                    wpfOcDispatcher.IsPaused = true;

            _searchTextThrottled.PostValueChanged += (sender, args) =>
            {
                wpfOcDispatcher.IsPaused = false;
                wpfOcDispatcher.Invoke(CommandManager.InvalidateRequerySuggested);
            };

            _hints =
                tradeService.Live.Selecting(t => t.CurrencyPair).Distincting()
                .Concatenating(
                    tradeService.Live.Selecting(t => t.Customer).Distincting())
                .Filtering(str =>
                           str.Contains(_searchTextThrottled.Value, StringComparison.OrdinalIgnoreCase) ||
                           str.Contains(_searchTextThrottled.Value, StringComparison.OrdinalIgnoreCase))
                .Ordering(s => s)
                .CollectionDispatching(wpfOcDispatcher, backgroundOcDispatcher)
                .For(_consumer);
        }
Ejemplo n.º 2
0
        public SearchHints(ITradeService tradeService, UserInputThrottlingOcDispatcher throttling)
        {
            _searchTextThrottled =
                new Computing <string>(() => SearchText)
                .ScalarDispatching(throttling)
                .SetDefaultValue("")
                .For(_consumer);

            _hints =
                tradeService.Live.Selecting(t => t.CurrencyPair).Distincting()
                .Concatenating(
                    tradeService.Live.Selecting(t => t.Customer).Distincting())
                .Filtering(str =>
                           str.Contains(_searchTextThrottled.Value, StringComparison.OrdinalIgnoreCase) ||
                           str.Contains(_searchTextThrottled.Value, StringComparison.OrdinalIgnoreCase))
                .Ordering(s => s)
                .For(_consumer);
        }