/// <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 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> /// 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> /// 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 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> /// Handles the Tick event of the m_timer control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void m_timer_Tick(object sender, EventArgs e) { m_timer.Stop(); if (!Enabled) { return; } // Actions according to mouse clicks switch (m_mouseEvent.Clicks) { case 1: { base.OnMouseClick(m_mouseEvent); } break; case 2: { base.OnMouseDoubleClick(m_mouseEvent); WindowsFactory.ShowByTag <EveImagePopUp, Item>(m_item); } break; } }
public ChatWindow GetChatWindow(Contact contact) { var chatWindow = WindowsFactory.GetInstance() .GetChatWindow(contact, _senderService); return(chatWindow); }
/// <summary> /// Handles the Click event of the buttonCharacter control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void buttonCharacter_Click(object sender, EventArgs e) { WindowsFactory.ShowByTag <AttributesOptimizerWindow, PlanEditorControl>(m_planEditorControl.ParentForm, m_planEditorControl, AttributeOptimizationStrategy.Character); Close(); }
public void Use_A_WindowsFactory_To_Create_A_Button() { GUIFactory factory = new WindowsFactory(); factory.CreateButton(window).Draw(window); Assert.AreEqual("WindowsButton", window.DrawnText); }
/// <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; }
public void ClickCommand_Issues_Through_Button_Returns_Clicked() { Button button = new WindowsFactory().CreateButton(window); button.Click(); Assert.AreEqual("Clicked", window.DrawnText); }
public static void OpenMainWindow(RailwaysDBAppMainMenu mainMenu) { WindowsFactory.HideOpenedWindows(); RailwaysDBAppMainWindow main = WindowsFactory.LoginWindow; App.OpenWindow(main); WindowsFactory.CloseHiddenWindows(); mainMenu.Close(); }
/// <summary> /// Shows the kill details. /// </summary> private void ShowKillDetails() { if (m_selectedKillLog == null) { return; } WindowsFactory.ShowByTag <KillReportWindow, KillLog>(m_selectedKillLog); }
/// <summary> /// Event handler for image double click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pbImage_DoubleClick(object sender, EventArgs e) { // Only display the pop up form if pop-ups are enabled and a suitable image can be retrieved if (!m_popUpActive) { return; } WindowsFactory <EveImagePopUp> .ShowUnique(() => new EveImagePopUp(m_item)); }
public void AbstractMethodTest() { IComputadorFactory computadorFactory = new WindowsFactory(); var pcWindows = computadorFactory.CrearComputadorPC("2 GB", "500 GB", "2.4 Ghz"); TestContext.WriteLine(pcWindows.GetType().Name); TestContext.WriteLine(pcWindows.ObtenerHDD()); TestContext.WriteLine(pcWindows.ObtenerRam()); TestContext.WriteLine(pcWindows.ObtenerCPU()); var serverWindows = computadorFactory.CrearComputadorServidor("2 GB", "500 GB", "2.4 Ghz"); TestContext.WriteLine(serverWindows.GetType().Name); TestContext.WriteLine(serverWindows.ObtenerHDD()); TestContext.WriteLine(serverWindows.ObtenerRam()); TestContext.WriteLine(serverWindows.ObtenerCPU()); computadorFactory = new MacFactory(); var pcMac = computadorFactory.CrearComputadorPC("2 GB", "500 GB", "2.4 Ghz"); TestContext.WriteLine(pcMac.GetType().Name); TestContext.WriteLine(pcMac.ObtenerHDD()); TestContext.WriteLine(pcMac.ObtenerRam()); TestContext.WriteLine(pcMac.ObtenerCPU()); var serverMac = computadorFactory.CrearComputadorServidor("2 GB", "500 GB", "2.4 Ghz"); TestContext.WriteLine(serverMac.GetType().Name); TestContext.WriteLine(serverMac.ObtenerHDD()); TestContext.WriteLine(serverMac.ObtenerRam()); TestContext.WriteLine(serverMac.ObtenerCPU()); computadorFactory = new LinuxFactory(); var pcLinux = computadorFactory.CrearComputadorPC("2 GB", "500 GB", "2.4 Ghz"); TestContext.WriteLine(pcLinux.GetType().Name); TestContext.WriteLine(pcLinux.ObtenerHDD()); TestContext.WriteLine(pcLinux.ObtenerRam()); TestContext.WriteLine(pcLinux.ObtenerCPU()); var serverLinux = computadorFactory.CrearComputadorServidor("2 GB", "500 GB", "2.4 Ghz"); TestContext.WriteLine(serverLinux.GetType().Name); TestContext.WriteLine(serverLinux.ObtenerHDD()); TestContext.WriteLine(serverLinux.ObtenerRam()); TestContext.WriteLine(serverLinux.ObtenerCPU()); Assert.IsTrue(pcLinux is Pc); Assert.IsTrue(serverLinux is Server); Assert.IsTrue(pcWindows is Pc); Assert.IsTrue(serverWindows is Server); Assert.IsTrue(pcMac is Pc); Assert.IsTrue(serverMac is Server); }
public void Windows_Uretimi() { ToolFactory factory = new WindowsFactory(); IDialog dialog = factory.CreateDialog(); dialog.GetDialog(); IToolbar toolbar = factory.CreateToolbar(); toolbar.GetToolbar(); }
/// <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 > 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); }
public ServiceLocatorStubBuilder() { Logger = Substitute.For <ILogger>(); LoggerFactory = Substitute.For <ILoggerFactory>(); LoggerFactory.CreateLogger(Arg.Any <Type>()).Returns(Logger); WindowsFactory = Substitute.For <IWindowsFactory>(); var window = Substitute.For <IModalWindow>(); WindowsFactory.CreateModalWindow().Returns(window); MessageBox = Substitute.For <IMessageBox>(); ApplicationServices = GenerateApplicationServicesStub(); }
/// <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); }
protected override void OnSelectionChanged(object sender, EventArgs e) { base.OnSelectionChanged(sender, e); if (SelectedObject == null) { return; } var loadoutSelect = WindowsFactory <ShipLoadoutSelectWindow> .GetUnique(); if (loadoutSelect != null) { loadoutSelect.Ship = (Item)shipSelectControl.SelectedObject; } }
/// <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> /// The button "open" is the same than "merge". When the button is in "open" state, we close the window and returns OK as a result. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOpen_Click(object sender, EventArgs e) { // Are we performing a merge ? if (lbPlanList.SelectedItems.Count > 1) { MergePlans(); return; } // Or are we just opening a plan ? var plan = (Plan)lbPlanList.SelectedItems[0].Tag; WindowsFactory <PlanWindow> .ShowByTag(plan); this.Close(); }
/// <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) { base.OnFormClosing(e); // Unsubscribe global events EveMonClient.PlanNameChanged -= EveMonClient_PlanNameChanged; EveMonClient.SettingsChanged -= EveMonClient_SettingsChanged; EveMonClient.ItemPricesUpdated -= EveMonClient_ItemPricesUpdated; // Save settings if this one is the last activated and up-to-date if (s_lastActivated == this) { if (tabControl.TabPages.Contains(tpPlanEditor)) { Settings.UI.PlanWindow.Columns.Clear(); Settings.UI.PlanWindow.Columns.AddRange(planEditor.ExportColumnSettings()); } s_lastActivated = null; } Settings.Save(); // 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 { // Tell the loadout importation window we're closing down WindowsFactory.GetAndCloseByTag <LoadoutImportationWindow, Character>(m_character); // Tell the ship loadout window we're closing down WindowsFactory.GetAndCloseByTag <ShipLoadoutSelectWindow, Character>(m_character); // Tell the skill explorer we're closing down WindowsFactory.GetAndCloseByTag <SkillExplorerWindow, Character>(m_character); // Tell the attributes optimization window we're closing down WindowsFactory.GetAndCloseByTag <AttributesOptimizerOptionsWindow, PlanEditorControl>(planEditor); WindowsFactory.GetAndCloseByTag <AttributesOptimizerWindow, PlanEditorControl>(planEditor); // Tell the implant window we're closing down WindowsFactory.GetAndCloseByTag <ImplantCalculatorWindow, PlanEditorControl>(planEditor); } }
/// <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); }
private static AbstractPlatform configurationPlatform() { AbstractPlatform _platform; IGUIFactory _gUIFactory; string _osName = Environment.OSVersion.ToString(); if (_osName.Contains("mac")) { _gUIFactory = new MacOSFactory(); _platform = new AbstractPlatform(_gUIFactory); } else { _gUIFactory = new WindowsFactory(); _platform = new AbstractPlatform(_gUIFactory); } return(_platform); }