/// <summary> /// Instatiates the UI class, creating a new GUI window, and linking to the events that the GUI window will raise. /// </summary> /// <param name="title">Window Title. Not seen, as the GUI Form has no borders or title bar.</param> /// <param name="closeable">Sets a flag which control whether the GUI Form may be closed by operator.</param> public UI(string title, bool closeable) { _browserForm = new BrowserForm(title + " (.NET WebBrowser)", closeable); _browserForm.Notify += Form_Notify; _browserForm.Loaded += Form_Loaded; _browserForm.Unloaded += Form_Unloaded; }
/// <summary> /// Hides and cleans up resources by the the GUI window. /// </summary> public void Dispose() { if (_browserForm != null) { _browserForm.Hide(); _browserForm.Dispose(); _browserForm = null; } GC.Collect(); // Start .NET CLR Garbage Collection GC.WaitForPendingFinalizers(); // Wait for Garbage Collection to finish }