public static void Show(Exception exception)
 {
     using (ExceptionViewForm form = new ExceptionViewForm(exception))
     {
         form.ShowDialog();
     }
 }
Example #2
0
        private void saveSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (SaveFileDialog dialog = new SaveFileDialog())
            {
                dialog.Filter          = "Settings files (*.json)|*.json|All files (*.*)|*.*";
                dialog.OverwritePrompt = true;
                dialog.CheckPathExists = true;
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                try
                {
                    Settings settings = (Settings)this.propertyGrid1.SelectedObject;
                    settings.SaveToFile(dialog.FileName);
                }
                catch (Exception ex)
                {
                    ExceptionViewForm.Show(ex);
                }
            }
        }
Example #3
0
        private void openSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Filter          = "Settings files (*.json)|*.json|All files (*.*)|*.*";
                dialog.CheckFileExists = true;
                dialog.Multiselect     = false;
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                try
                {
                    Settings settings = Settings.LoadFromFile(dialog.FileName);
                    this.propertyGrid1.SelectedObject = settings;
                }
                catch (Exception ex)
                {
                    ExceptionViewForm.Show(ex);
                }
            }
        }