コード例 #1
0
        /// <summary>
        /// Called when the edit button of an expense is clicked. Triggering the dialog.
        /// </summary>
        /// <param name="e">Expense the button was clicked for.</param>
        private void editButton_Click(Expense e)
        {
            AddEditExpenseDialog editDialog = new AddEditExpenseDialog(e);

            if (editDialog.ShowDialog() == DialogResult.OK)
            {
                this.controller.EditExpense(editDialog.Expense);
            }
        }
コード例 #2
0
        /// <summary>
        /// Activates when a user selects to add an expense.
        /// </summary>
        /// <param name="sender">Object that registered the event.</param>
        /// <param name="e">Arguments passed with the event.</param>
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddEditExpenseDialog addDialog = new AddEditExpenseDialog();

            if (addDialog.ShowDialog() == DialogResult.OK)
            {
                // get the information from the form.
                this.controller.InsertExpense(addDialog.Expense);
            }
        }