Exemplo n.º 1
0
        private void ProjectDetails_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                this.projectBindingSource.EndEdit();

                if (this.service.HasChanges())
                {
                    DialogResult dlg =
                        MessageBox.Show("The current project has unsaved changes. Should they be saved now?",
                                        "Confirm Saving", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
                    if (dlg == System.Windows.Forms.DialogResult.Yes)
                    {
                        throw new Exception("Please choose 'Save' from the menu.");
                    }
                    else if (dlg == System.Windows.Forms.DialogResult.Cancel)
                    {
                        throw new Exception("Aborted by user");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error while quitting the application");
                e.Cancel = true;
                return;
            }
            this.service.Dispose();
            r.Dispose();
            GC.Collect();
            Application.Exit();
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (rEngine == null)
     {
         return;
     }
     rEngine.Dispose();
 }