/// <summary> /// Toolbar > Implants calculator. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbImplantCalculator_Click(object sender, EventArgs e) { if (m_implantCalcWindow == null) { m_implantCalcWindow = new ImplantCalculator(m_plan); m_implantCalcWindow.FormClosed += (form, args) => m_implantCalcWindow = null; m_implantCalcWindow.PlanEditor = (tabControl.SelectedIndex == 0) ? planEditor : null; m_implantCalcWindow.Show(this); } else { m_implantCalcWindow.Visible = true; m_implantCalcWindow.BringToFront(); m_implantCalcWindow.PlanEditor = (tabControl.SelectedIndex == 0) ? planEditor : null; } }
/// <summary> /// On closing, we unsubscribe the global events to help the GC. /// </summary> /// <param name="e"></param> protected override void OnFormClosing(FormClosingEventArgs e) { // Save settings if this one is the last activated and up-to-date if (s_lastActivated == this) { Settings.UI.PlanWindow.Columns = planEditor.ExportColumnSettings().ToArray(); s_lastActivated = null; } // Unsubscribe global events EveClient.PlanChanged -= new EventHandler <PlanChangedEventArgs>(EveClient_PlanChanged); Settings.Save(); // Tell the skill explorer we're closing down if (!(e.CloseReason == CloseReason.ApplicationExitCall) && // and Application.Exit() was not called !(e.CloseReason == CloseReason.TaskManagerClosing) && // and the user isn't trying to shut the program down for some reason !(e.CloseReason == CloseReason.WindowsShutDown)) // and Windows is not shutting down { WindowsFactory <SkillExplorerWindow> .CloseByTag(this); } // Tell the attributes optimization window we're closing if (m_attributesOptimizerWindow != null) { m_attributesOptimizerWindow.Close(); m_attributesOptimizerWindow = null; } // Tell the implant window we're closing if (m_implantCalcWindow != null) { m_implantCalcWindow.Close(); m_implantCalcWindow = null; } // Tells the loadout browser we're closing if (m_loadoutForm != null) { m_loadoutForm.Close(); m_loadoutForm = null; } base.OnFormClosing(e); }