Exemple #1
0
        private void btn_updateNow_Click(object sender, EventArgs e)
        {
            DownloadUpdateDialog dlg = new DownloadUpdateDialog(url);

            dlg.StartPosition = FormStartPosition.CenterParent;

            dlg.ShowDialog();

            Close();
        }
Exemple #2
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (ProjectDirty)
            {
                SaveChangesDialog dlg = new SaveChangesDialog();

                dlg.StartPosition = FormStartPosition.CenterParent;

                switch (dlg.ShowDialog())
                {
                case DialogResult.Yes:
                    if (ProjectFileName != null)
                    {
                        ProjectSave(ProjectFileName);
                    }
                    else
                    {
                        e.Cancel = ProjectSaveAs() != DialogResult.OK;
                    }
                    break;

                case DialogResult.No:                         // TODO: Add a preference for overwriting the autosave file if you decline.
                    // AutoSave();
                    break;

                case DialogResult.Cancel:
                    e.Cancel = true;
                    return;

                default:
                    throw new ArgumentException("Unknown Dialog Result");
                }
            }

            if (!e.Cancel)
            {
                ProjectDirty = false;

                if (Program.updateScheduled)
                {
                    e.Cancel = true;
                    Program.updateScheduled = false;

                    Hide();

                    DownloadUpdateDialog dlg = new DownloadUpdateDialog(Program.updateUrl);

                    dlg.ShowDialog();
                    Close();
                }
            }
        }