/// <summary> /// Context menu > Show "skill" in browser | Show "certificate class" certificates. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void showInBrowserMenu_Click(object sender, EventArgs e) { // Retrieve the owner window PlanWindow npw = WindowsFactory <PlanWindow> .GetByTag(m_plan); if (npw == null || npw.IsDisposed) { return; } // Return when nothing is selected if (this.treeView.SelectedNode == null) { return; } Certificate cert = this.treeView.SelectedNode.Tag as Certificate; // When a certificate is selected, we select its class in the left tree if (cert != null) { npw.ShowCertInBrowser(cert); } // When a skill is selected, we select it in the skill browser else { SkillLevel prereq = (SkillLevel)this.treeView.SelectedNode.Tag; npw.ShowSkillInBrowser(prereq.Skill); } }
/// <summary> /// Updates the opened windows. /// </summary> /// <param name="value">The value.</param> private void UpdateOpenedWindows(Plan value) { // If the EFTLoadoutImportationForm is open, assign the new plan // We do the check here as we need to catch the previous plan value LoadoutImportationWindow eftloadoutImportation = WindowsFactory.GetByTag <LoadoutImportationWindow, Character>(m_character); if (eftloadoutImportation != null) { eftloadoutImportation.Plan = value; } // If the ShipLoadoutSelectWindow is open, assign the new plan ShipLoadoutSelectWindow loadoutSelect = WindowsFactory.GetByTag <ShipLoadoutSelectWindow, Character>(m_character); if (loadoutSelect != null) { loadoutSelect.Plan = value; } // If the SkillExplorerWindow is open, assign the new plan SkillExplorerWindow skillExplorer = WindowsFactory.GetByTag <SkillExplorerWindow, Character>(m_character); if (skillExplorer != null) { skillExplorer.Plan = value; } }
/// <summary> /// When the plans menu is opening, we update the items. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsddbPlans_DropDownOpening(object sender, EventArgs e) { tsddbPlans.DropDownItems.Clear(); tsddbPlans.DropDownItems.Add("<New Plan>"); // Add items for every plan foreach (var plan in this.Character.Plans) { try { ToolStripDropDownItem tsddiTemp = (ToolStripDropDownItem)tsddbPlans.DropDownItems.Add(plan.Name); tsddiTemp.Tag = plan; // Put current plan to bold if (plan == m_plan) { tsddiTemp.Enabled = false; } // Is it already opened in another plan ? else if (WindowsFactory <PlanWindow> .GetByTag(plan) != null) { tsddiTemp.Font = FontFactory.GetFont(tsddiTemp.Font, FontStyle.Italic); } } catch (InvalidCastException) { // Visual studio cannot set the text of a // TooStripDropDownItem to "-" because that is the // placeholder for a seperator. } } }
/// <summary> /// Updates the controls when the selection is changed. /// </summary> protected override void OnSelectionChanged() { base.OnSelectionChanged(); if (SelectedObject == null) { return; } // Description tbDescription.Text = SelectedObject.Description; // Required Skills requiredSkillsControl.Object = SelectedObject; // Update the Mastery tab masteryTreeDisplayControl.MasteryShip = Character?.MasteryShips.GetMasteryShipByID(SelectedObject.ID); ShipLoadoutSelectWindow loadoutSelect = WindowsFactory.GetByTag <ShipLoadoutSelectWindow, Character>(Character); if (loadoutSelect != null) { loadoutSelect.Ship = shipSelectControl.SelectedObject; } // Update the eligibity controls UpdateEligibility(); }
/// <summary> /// Occurs when clicking the button. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void splitButtonLoadouts_Click(object sender, EventArgs e) { if (Character == null) { return; } if (Settings.LoadoutsProvider.Provider == null) { return; } ShipLoadoutSelectWindow loadoutWindow; if (Plan != null) { loadoutWindow = WindowsFactory.GetByTag <ShipLoadoutSelectWindow, Character>(Character); if (loadoutWindow == null) { loadoutWindow = WindowsFactory.ShowByTag <ShipLoadoutSelectWindow, Plan>(Plan); WindowsFactory.ChangeTag <ShipLoadoutSelectWindow, Plan, Character>(Plan, Character); } else { loadoutWindow = WindowsFactory.ShowByTag <ShipLoadoutSelectWindow, Character>(Character); } } else { loadoutWindow = WindowsFactory.ShowByTag <ShipLoadoutSelectWindow, Character>(Character); } loadoutWindow.Ship = SelectedObject; }
/// <summary> /// Event handler for treenode double click event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tvCertList_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { // Get selected node TreeNode selectedNode = e.Node as TreeNode; // Make sure we have a skill to use if (selectedNode.Tag == null) { return; } if (selectedNode.Tag is Certificate) { PlanWindow pw = WindowsFactory <PlanWindow> .GetByTag(m_plan); Certificate cert = ((Certificate)selectedNode.Tag); pw.ShowCertInBrowser(cert); } else { // Open skill browser tab for this skill PlanWindow pw = WindowsFactory <PlanWindow> .GetByTag(m_plan); Skill skill = ((SkillLevel)selectedNode.Tag).Skill; pw.ShowSkillInBrowser(skill); } }
/// <summary> /// Show the given skill in the skill explorer. /// </summary> /// <param name="skill"></param> public void ShowSkillInExplorer(Skill skill) { var planWindow = WindowsFactory <PlanWindow> .GetByTag(m_plan); var skillExplorer = WindowsFactory <SkillExplorerWindow> .ShowByTag(planWindow, (window) => new SkillExplorerWindow(skill, window)); skillExplorer.Skill = skill; }
/// <summary> /// Context menu > Show In Skill Explorer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void showInSkillExplorerMenu_Click(object sender, EventArgs e) { // Retrieve the owner window PlanWindow npw = WindowsFactory <PlanWindow> .GetByTag(m_plan); if (npw == null || npw.IsDisposed) { return; } // Open the skill explorer npw.ShowSkillInExplorer(SelectedSkill); }
/// <summary> /// Browses the form that opened this instance of EFTLoadout to /// the item that was double clicked in the TreeView. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">Arguments of the event.</param> private void tvLoadout_DoubleClick(object sender, EventArgs e) { if (ResultsTreeView.SelectedNode != null) { Item item = ResultsTreeView.SelectedNode.Tag as Item; if (item != null) { PlanWindow opener = WindowsFactory <PlanWindow> .GetByTag(m_plan); opener.ShowItemInBrowser(item); } } }
/// <summary> /// Show the item in its appropriate browser. /// </summary> /// <param name="item"></param> private void ShowInBrowser(Item item) { PlanWindow pw = WindowsFactory <PlanWindow> .GetByTag(m_plan); if (item is Ship) { pw.ShowShipInBrowser(item); } else { pw.ShowItemInBrowser(item); } }
/// <summary> /// Context menu > Show "skill" in explorer. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void showInExplorerMenu_Click(object sender, EventArgs e) { // Retrieve the owner window PlanWindow npw = WindowsFactory <PlanWindow> .GetByTag(m_plan); if (npw == null || npw.IsDisposed) { return; } // Open the skill explorer SkillLevel prereq = (SkillLevel)this.treeView.SelectedNode.Tag; npw.ShowSkillInExplorer(prereq.Skill); }
/// <summary> /// Context > Show in Skill Browser /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void showInSkillBrowserMenu_Click(object sender, EventArgs e) { // Retrieve the owner window PlanWindow npw = WindowsFactory <PlanWindow> .GetByTag(m_plan); if (npw == null || npw.IsDisposed) { return; } // Open the skill explorer var skillLevel = (SkillLevel)tvSkillList.SelectedNode.Tag; npw.ShowSkillInBrowser(skillLevel.Skill); }
/// <summary> /// Handler for the ship-links generated for the recommendations /// </summary> void recommendations_MenuItem(object sender, EventArgs e) { Control tsi = sender as Control; if (tsi == null) { return; } Item ship = tsi.Tag as Item; PlanWindow window = WindowsFactory <PlanWindow> .GetByTag(m_plan); if (ship != null && window != null && !window.IsDisposed) { window.ShowShipInBrowser(ship); } }
/// <summary> /// Event handler for treenode double click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tvSkillList_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { // Get selected node TreeNode thisNode = e.Node as TreeNode; // Make sure we have a skill to use if (thisNode.Tag == null) { return; } // Open skill browser tab for this skill PlanWindow pw = WindowsFactory <PlanWindow> .GetByTag(m_plan); Skill skill = ((SkillLevel)thisNode.Tag).Skill; pw.ShowSkillInBrowser(skill); }
/// <summary> /// Occurs when the user clicks one of the children of the "Plans" menu. /// The item may be an existing plan or the "New plan" item. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsddbPlans_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Tag == m_plan) { return; } // Is it another plan ? if (e.ClickedItem.Tag != null) { var plan = (Plan)e.ClickedItem.Tag; var window = WindowsFactory <PlanWindow> .GetByTag(plan); // Opens the existing window when there is one, or switch to this plan when no window opened. if (window != null) { window.BringToFront(); } else { Plan = plan; } return; } // So it is "new plan" using (NewPlanWindow npw = new NewPlanWindow()) { DialogResult dr = npw.ShowDialog(); if (dr == DialogResult.Cancel) { return; } var plan = new Plan(Character) { Name = npw.Result }; Character.Plans.Add(plan); Plan = plan; } }
/// <summary> /// Updates the owned skill book controls. /// </summary> private void UpdateOwnedSkillBookControls() { // Set button check state according to skills 'owned' property; // this will also trigger a check through the character's assets ownsBookToolStripButton.Checked = m_selectedSkill.IsOwned | (m_selectedSkill.HasBookInAssets && !m_selectedSkill.IsKnown); skillSelectControl.UpdateContent(); // Update also the skill selector of the Plan Editor PlanWindow planWindow = ParentForm as PlanWindow; planWindow?.UpdatePlanEditorSkillSelection(); // Update the Owned Skill books window if open OwnedSkillBooksWindow ownedSkillBooksWindow = WindowsFactory.GetByTag <OwnedSkillBooksWindow, Character>((Character)m_plan.Character); ownedSkillBooksWindow?.UpdateList(); }
/// <summary> /// When the plans menu is opening, we update the items. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsddbPlans_DropDownOpening(object sender, EventArgs e) { tsddbPlans.DropDownItems.Clear(); tsddbPlans.DropDownItems.Add("<New Plan>"); Character.Plans.AddTo(tsddbPlans.DropDownItems, (menuPlanItem, plan) => { menuPlanItem.Tag = plan; // Put current plan to bold if (plan == m_plan) { menuPlanItem.Enabled = false; } // Is it already opened in another plan ? else if (WindowsFactory <PlanWindow> .GetByTag(plan) != null) { menuPlanItem.Font = FontFactory.GetFont(menuPlanItem.Font, FontStyle.Italic); } }); }
/// <summary> /// Context menu > Show "skill" in browser | Show "certificate class" certificates. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void showInSkillBrowserMenu_Click(object sender, EventArgs e) { // Retrieve the owner window PlanWindow npw = WindowsFactory <PlanWindow> .GetByTag(m_plan); if (npw == null || npw.IsDisposed) { return; } Certificate cert = tvCertList.SelectedNode.Tag as Certificate; // When a certificate is selected if (cert != null) { npw.ShowCertInBrowser(cert); } // When a skill is selected else { SkillLevel prereq = (SkillLevel)tvCertList.SelectedNode.Tag; npw.ShowSkillInBrowser(prereq.Skill); } }
/// <summary> /// Performs the action for the "Plan To N" and "Remove" menu options. /// </summary> /// <param name="operation"></param> /// <returns></returns> public static bool Perform(IPlanOperation operation) { var window = WindowsFactory <PlanWindow> .GetByTag(operation.Plan); return(Perform(window, operation)); }