Exemple #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();
            });
        }
Exemple #2
0
        private static async Task GetCustomerPrices()
        {
            using (var stoper = new Stoper())
            {
                var customerPrices = await _customerPriceService.GetCustomersPrices();

                DisplayCustomerPrices(customerPrices);
            }

            Console.WriteLine();
        }
Exemple #3
0
        private static async Task GetCustomerPrices()
        {
            using (var stope = new Stoper())
            {
                var result = await _priceGrpc.GetProductBasePricesAsync(new Google.Protobuf.WellKnownTypes.Empty());

                foreach (var item in result.ProductPrices)
                {
                    DisplayProduct(item);
                }
            }
        }
Exemple #4
0
 private static async Task GetCustomerPricesRx()
 {
     using (var stope = new Stoper())
     {
         using (var productCall = _priceGrpc.GetProductBasePricesRx(new Google.Protobuf.WellKnownTypes.Empty()))
         {
             while (await productCall.ResponseStream.MoveNext(CancellationToken.None))
             {
                 DisplayProduct(productCall.ResponseStream.Current);
             }
         }
     }
 }
Exemple #5
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);
        }
Exemple #6
0
        private static async Task GetProductBasePrice()
        {
            var productService = new ProductPriceService();

            using (var stoper = new Stoper())
            {
                var productPrices = await productService.GetProductBasePrices();

                foreach (var item in productPrices)
                {
                    HappyConsole.WriteBlueLine($"{item.ProductId,2} - {item.Price,5} - {item.IsActive}");
                }
            }
        }
Exemple #7
0
        private static Task GetCustomerPricesRx()
        {
            var stoper = new Stoper();

            DisplayCustomerPricesHeader();

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

            return(Task.CompletedTask);
        }
Exemple #8
0
 public void SubscribeStoper(Stoper stoprer)
 {
     start = stoprer.Start;
     stop  = stoprer.Stop;
 }
 public CoreWorker()
 {
     stoper = new Stoper();
 }