Пример #1
0
        private void CreateButton_Click(object sender, EventArgs e)
        {
            if (_messages.Add())
            {
                if (!_messages.SaveMessages())
                {
                    MessageBox.Show("Unable to save some or all messages.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                ClearMessageDetails();
                ToggleButtons(false, DASH);
                SearchTB.SetText(string.Empty);
                UpdateMessages();
                ClearMessageDisplay();
            }
        }
Пример #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;
            }
        }