/// <summary> /// Function called when the close button is clicked. /// </summary> private void OnCloseClicked() { if (Content == null) { return; } labelClose.Enabled = false; try { var args = new CancelEventArgs(); OnContentClosing(args); if (args.Cancel) { return; } if (ContentClosed != null) { args = new CancelEventArgs(); ContentClosed(this, args); if (args.Cancel) { return; } } ContentManagement.LoadDefaultContentPane(); } finally { if (!labelClose.IsDisposed) { labelClose.Enabled = true; } } }
/// <summary> /// Initializes a new instance of the <see cref="AppContext"/> class. /// </summary> public AppContext() { float startTime = GorgonTiming.SecondsSinceStart; try { PlugIns.DefaultImageEditorPlugIn = Program.Settings.DefaultImageEditor; _splash = new FormSplash(); MainForm = new FormMain(); _splash.Show(); _splash.Refresh(); // Fade in our splash screen. FadeSplashScreen(true, 500.0f); EditorLogging.Open(); InitializeGraphics(); InitializePlugIns(); InitializeScratchArea(); InitializeInput(); FileManagement.InitializeFileTypes(); // Load the last opened file. if ((Program.Settings.AutoLoadLastFile) && (!string.IsNullOrWhiteSpace(Program.Settings.LastEditorFile))) { LoadLastFile(); } // Set up the default pane. _splash.UpdateVersion(Resources.GOREDIT_TEXT_LOAD_DEFAULT); ContentManagement.DefaultContentType = typeof(DefaultContent); ContentManagement.LoadDefaultContentPane(); // Keep showing the splash screen. while ((GorgonTiming.SecondsSinceStart - startTime) < 3) { Thread.Sleep(1); } FadeSplashScreen(false, 250.0f); // Bring up our application form. MainForm.Show(); } catch (Exception ex) { GorgonDialogs.ErrorBox(null, ex); if ((MainForm != null) && (!MainForm.IsDisposed)) { MainForm.Dispose(); } // Signal quit. Gorgon.Quit(); } finally { if (_splash != null) { _splash.Dispose(); } _splash = null; } }