private void CloseCurrentApp() { richTextBox1.Text = Resources.MainWindow_CloseCurrentApp_Loading___; if (_currentApp != null) { _currentApp.DeInit(); } // Clean up _currentApp = null; if (_currentControl != null) { _currentControl.HandleCreated -= renderControl_HandleCreated; _currentControl.Dispose(); splitContainer1.Panel2.Controls.Remove(_currentControl); _currentControl = null; } if (_currentHost != null) { _currentHost.Dispose(); _currentHost = null; } // Just in case... GC.Collect(); GC.WaitForPendingFinalizers(); }
private void CloseCurrentApp() { richTextBox1.Text = ""; // Clean up _currentApp = null; if (_currentControl != null) { _currentControl.HandleCreated -= renderControl_HandleCreated; splitContainer1.Panel2.Controls.Remove(_currentControl); _currentControl.Dispose(); _currentControl = null; } if (_currentHost != null) { _currentHost.Dispose(); _currentHost = null; } // Just in case... GC.Collect(); GC.WaitForFullGCComplete(); }
private void renderControl_HandleCreated(object sender, EventArgs e) { // // STEP TWO - Now the underlying Windows Window was created - we can hook OpenGL on it. // // Take this as an example how to hook up any FUSEE application on a given Winforms form: // First create a WinformsHost around the control _currentHost = new WinformsHost(_currentControl, this); // Then instantiate your app (could be as well _currentApp = new MyOwnRenderCanvasDerivedClass(); ) _currentApp = _appFinder.Instantiate(_currentInx); // Now use the host as the canvas AND the input implementation of your App _currentApp.CanvasImplementor = _currentHost; _currentApp.InputImplementor = _currentHost; // Then you can run the app _currentApp.Run(); // If not already done, show the window. _currentControl.Show(); }