Пример #1
0
        private void ButtonReacativeOnClick(object sender, System.Windows.RoutedEventArgs e)
        {
            var cityWeatherRxService = new CityWeatherRxService();

            CitiesWithWeather.Clear();
            DisplayCount();

            var stoper = new Stoper(Time);

            cityWeatherRxService
            .SearchCityAndLoadWeatherInfo(TextBox.Text)
            .Buffer(TimeSpan.FromSeconds(2))
            .ObserveOnDispatcher()
            .Subscribe(
                x =>
            {
                foreach (var item in x)
                {
                    CitiesWithWeather.Add(item);
                }

                DisplayCount();
            },
                () =>
            {
                stoper.Dispose();
                DisplayCount();
            });
        }
Пример #2
0
        private static Task GetProductBasePricesRx()
        {
            var productService = new ProductPriceService();

            var stoperRx = new Stoper();

            productService
            .GetProductBasePricesRx()
            .Subscribe(
                x => HappyConsole.WriteCyanLine($"{x.ProductId,2} - {x.Price,5} - {x.IsActive}"),
                () => stoperRx.Dispose());

            return(Task.CompletedTask);
        }
Пример #3
0
        private static Task GetCustomerPricesRx()
        {
            var stoper = new Stoper();

            DisplayCustomerPricesHeader();

            _customerPriceService
            .GetCustomersPricesRx()
            .Subscribe(
                x => DisplaySingleCustomerPrice(x),
                () =>
            {
                DisplayCustomerPricesFooter();
                stoper.Dispose();
            });

            return(Task.CompletedTask);
        }