/// <summary> /// Toolbar > Delete. /// Prompts the user and delete the currently selected plan. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbDeletePlan_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Are you sure you want to delete this plan?", "Delete Plan", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr != DialogResult.Yes) { return; } // Close the skill explorer WindowsFactory <SkillExplorerWindow> .CloseByTag(this); // Remove the plan Character.Plans.Remove(m_plan); }
/// <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); }
/// <summary> /// Toolbar > Delete. /// Prompts the user and delete the currently selected plan. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbDeletePlan_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Are you sure you want to delete this plan?", "Delete Plan", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr != DialogResult.Yes) { return; } // Close the skill explorer WindowsFactory <SkillExplorerWindow> .CloseByTag(this); // Remove the plan var i = Character.Plans.IndexOf(m_plan); Character.Plans.Remove(m_plan); // Choose which plan to show next // By default we choose the next one, // if it was the last in the list we select the previous one if (i > Character.Plans.Count - 1) { i--; } // When no plans exists after deletion we close the window if (i < 0) { Close(); return; } // New plan to show var newplan = Character.Plans[i]; Plan = newplan; }