private async void CheckBalance(object sender, RoutedEventArgs e) { await GetTotalBalance(); var stringCoin = $": {XmlManager.GetCurrentTotal().ToString()} KCoin"; txtTotal.Text = stringCoin; }
private async void MakeTransaction(object sender, RoutedEventArgs e) { if (Outputs.Count == 0) { MessageBox.Show("You don't have Output"); return; } await GetTotalBalance(); float spend = 0; float total = XmlManager.GetCurrentTotal(); var stringCoin = $": {total.ToString()} KCoin"; txtTotal.Text = stringCoin; foreach (Output output in Outputs) { spend += output.Amount; } if (total < spend) { MessageBox.Show("You don't have enough money"); return; } Transaction transaction = new Transaction(Outputs); TransactionProtocol protocol = new TransactionProtocol(); TransactionResponse response = await protocol.MakeTransaction(transaction); if (response.Status == "invalid") { MessageBox.Show(response.Message, "Error"); } Outputs.Clear(); lvOutput.ItemsSource = null; lvOutput.ItemsSource = Outputs; }