コード例 #1
0
        /// <summary>
        /// Обработчик нажатия кнопки перевода денег
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void transfer_Click(object sender, RoutedEventArgs e)
        {
            if (accountFromListBox.Items.Count < 1 || accountToListBox.Items.Count < 1)
            {
                return;
            }

            Account accountFrom = accountFromListBox.Items[0] as Account;
            Account accountTo   = accountToListBox.Items[0] as Account;

            if (accountFrom == null || accountTo == null)
            {
                return;
            }
            if (!Int32.TryParse(sumTextBox.Text, out int sum))
            {
                MessageBox.Show("Введите корректную сумму!");
                return;
            }
            accountFrom.BalanceTransferTo(accountTo, sum);
            ClientListView.Items.Refresh();
            MessageBox.Show("Перевод выполнен");
        }