void m_immersingInformationForm_FormClosed(object sender, FormClosedEventArgs e) { m_immersingInformationForm.Dispose(); m_immersingInformationForm = null; }
private void showImmersingInformation_Click(object sender, EventArgs e) { if (m_immersingInformationForm == null) { m_immersingInformationForm = new ImmersingInformation(); m_immersingInformationForm.UpdateData(IApp.theApp.DataDriven.CurrentData); m_immersingInformationForm.Show(this); m_immersingInformationForm.FormClosed += new FormClosedEventHandler(m_immersingInformationForm_FormClosed); } else { m_immersingInformationForm.Visible = !m_immersingInformationForm.Visible; } }
// Handler the form closing private void MainUI_FormClosing(object sender, FormClosingEventArgs e) { // Stop active command IApp.theApp.CommandManager.StopActiveCommand(); if (m_immersingInformationForm != null) { m_immersingInformationForm.Dispose(); m_immersingInformationForm = null; } // Step 3: Deinitialize the event and free the memory of our objects. to do... CReplayMode replayMode = IApp.theApp.ObserverModeManager.ActiveModeInstance as CReplayMode; if (replayMode != null) { replayMode.ReplayAnimationEngine.StopAnimation(); } // Step1: Check if video is still recoding, must end record before exit if (IApp.theApp.VideoWriter.IsRecording) { MessageBox.Show(Resources.IDS_WARNING_ISRECORDING, this.Text); e.Cancel = true; return; } // Step 2: Double check to ask if user really want to exit if (DialogResult.Yes != MessageBox.Show(Resources.IDS_WARNING_EXIT, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { e.Cancel = true; return; } // Write the Application Option ApplicationOptions.Instance().WriteData(System.IO.Path.Combine(CFolderUtility.DataFolder(), /*MSG0*/@"app.opt")); axesWidgetaMain.Dispose(); axesWidgetTopView.Dispose(); axesWidgetFrontView.Dispose(); axesWidgetRightView.Dispose(); m_mainRenderOutlineActor.Dispose(); m_topRenderOutlineActor.Dispose(); m_rightRenderOutlineActor.Dispose(); m_frontRenderOutlineActor.Dispose(); m_mainRenderOutlinePoints.Dispose(); m_topRenderOutlinePoints.Dispose(); m_frontRenderOutlinePoints.Dispose(); m_rightRenderOutlinePoints.Dispose(); // Dispose the application instance IApp.theApp.Dispose(); }