コード例 #1
0
        private void AddEvent_Click(object sender, EventArgs e)
        {
            if (_events.Add())
            {
                if (!_events.SaveEvents())
                {
                    MessageBox.Show("Unable to save some or all events.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                UpdateView();
            }
        }
コード例 #2
0
        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure you want to exit?", "Exit ChillSched", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (!_error)
                {
                    BackupIOConsts.ArchiveOldAll();
                    bool savedEvents   = _events.SaveEvents();
                    bool savedMessages = _messages.SaveMessages();


                    if (!savedEvents || !savedMessages)
                    {
                        MessageBox.Show("Unable to save some or all events and messages.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                e.Cancel = true;
            }
        }