コード例 #1
0
        /// <summary>
        /// Handle Edit entry event.
        /// </summary>
        private void BtnEditEntry_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (dataGridView.SelectedRows.Count > 0)
                {
                    if (dataGridView.SelectedRows[0].DataBoundItem is AccountData accountItem)
                    {
                        var editEntry = new AddEntry(accountItem);
                        if (editEntry.ShowDialog() == DialogResult.OK)
                        {
                            m_modified = true;
                            //m_accountData.Remove(accountItem);
                            //m_accountData.Add(editEntry.GetAccountData());

                            dataGridView.AutoResizeColumns();
                            dataGridView.AutoResizeRows();

                            UpdateDisplayState();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                m_logger.LogError(ex.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Handle Add Entry event.
        /// </summary>
        private void BtnAddEntry_Click(object sender, System.EventArgs e)
        {
            try
            {
                var addEntry = new AddEntry();
                if (addEntry.ShowDialog() == DialogResult.OK)
                {
                    m_modified = true;
                    var data = addEntry.GetAccountData();
                    m_accountData.Add(data);
                    m_displayedaccountData.Add(data);
                    dataGridView.AutoResizeColumns();
                    dataGridView.AutoResizeRows();

                    UpdateDisplayState();
                }
            }
            catch (Exception ex)
            {
                m_logger.LogError(ex.Message);
            }
        }