private async void ConfirmBtn_Click(object sender, EventArgs e) { try { // Try to create new order await _repo.CreateProductOrdersAsync(order, cart); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } ShowReceipt(); // Set order to paid order.Paid = true; try { // Try to update orderstatus to paid await _repo.UpdateOrderStatusAsync(order); } catch (Exception msg) { MessageBox.Show("Ett fel inträffade:", msg.ToString()); Application.Exit(); } // Close after n seconds await Task.Delay(TimeSpan.FromSeconds(2)); ReturnToEntryForm(); }