private async void BtnAddOrder_Click(object sender, RoutedEventArgs e) { var addOrderWindow = new AddOrderWindow(_makeOrderViewModel) { Owner = this }; var result = addOrderWindow.ShowDialog(); if (result.HasValue && result.Value) { var order = new Order { SessionId = _makeOrderViewModel.SelectedSession.Id, TicketsCount = _makeOrderViewModel.TicketsCount == 0 ? 1 : _makeOrderViewModel.TicketsCount, Sold = DateTime.Now }; var progress = new ProgressWindow("Оформление заказа...") { Owner = this }; progress.Show(); BtnAddOrder.IsEnabled = false; await ApiClient.AddOrderAsync(order); BtnAddOrder.IsEnabled = true; progress.Close(); order.Session = _makeOrderViewModel.SelectedSession; await UpdateOrders(); } _makeOrderViewModel.Reset(); }