private void Button_Click(object sender, RoutedEventArgs e) { decimal startBalance; var chosenClient = clientCombo.SelectedItem as Client; if (decimal.TryParse(balanceBox.Text, out startBalance) && chosenClient != null) { IAccount acc = Factory.Instance.GAccount(); acc.AddAccount(chosenClient.Id, startBalance); UpdateAccount?.Invoke(); balanceBox.Text = null; clientCombo.SelectedItem = null; MessageBox.Show("You've successfully added a new account"); } else { MessageBox.Show("Invalid input data"); } }
public void OnUpdateAccount(DateTime time, IEnumerable <AccountInfo> newAccounts, IEnumerable <AccountInfo> oldAccounts) { Task.Run(() => UpdateAccount?.Invoke(this, new Tuple <DateTime, IEnumerable <AccountInfo>, IEnumerable <AccountInfo> >(time, newAccounts, oldAccounts))); }
public void OnUpdateAccount(DateTime time, AccountInfo newAccount, AccountInfo oldAccount) { Task.Run(() => UpdateAccount?.Invoke(this, new Tuple <DateTime, IEnumerable <AccountInfo>, IEnumerable <AccountInfo> >(time, new[] { newAccount }, new[] { oldAccount }))); }