Exemplo n.º 1
0
        private async void SaveSelectedProducts()
        {
            IsExporting      = true;
            _ctsSaveProducts = new CancellationTokenSource();

            var products = SelectedProducts.ToList();

            try
            {
                var task = Export.SaveCollection(products, _ctsSaveProducts.Token);
                CriticalTasks.Add(task);
                await task.ConfigureAwait(false);
            }
            catch (TaskCanceledException)
            {
            }
            catch (System.Exception e)
            {
                _logger.Error(e);
                await MessageBox.ShowAsync("Произошла ошибка во время экспорта.", "Ошибка", MessageBoxButton.OK,
                                           MessageBoxImage.Error).ConfigureAwait(false);
            }
            CriticalTasks.Cleanup();

            IsExporting = false;
        }
Exemplo n.º 2
0
        private async void StartAsync()
        {
            var task = SearchStartAsync();

            CriticalTasks.Add(task);
            await task.ConfigureAwait(false);

            CriticalTasks.Cleanup();
        }