示例#1
0
        /// <summary>
        /// Treeview's context menu > Plan "(selection)".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmAddToPlan_Click(object sender, EventArgs e)
        {
            var            masteryLevel = treeView.SelectedNode.Tag as Mastery;
            var            certLevel    = treeView.SelectedNode.Tag as CertificateLevel;
            IPlanOperation operation    = null;

            if (masteryLevel != null)
            {
                operation = m_plan.TryPlanTo(masteryLevel);
            }
            else if (certLevel != null)
            {
                operation = m_plan.TryPlanTo(certLevel);
            }
            else
            {
                var prereq = treeView.SelectedNode.Tag as SkillLevel;
                if (prereq != null)
                {
                    operation = m_plan.TryPlanTo(prereq.Skill, prereq.Level);
                }
            }

            if (operation != null)
            {
                var planWindow = ParentForm as PlanWindow;
                if (planWindow != null)
                {
                    PlanHelper.SelectPerform(new PlanToOperationWindow(operation), planWindow,
                                             operation);
                }
            }
        }
示例#2
0
        /// <summary>
        /// When the user clicks the "plan" button, we add the prerqs to the plan and refresh the display.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlan_Click(object sender, EventArgs e)
        {
            var operation = m_plan.TryAddSet(m_prerequisites, m_selectedLoadout.LoadoutName);

            PlanHelper.Perform(operation);
            UpdatePlanningControls();
        }
示例#3
0
        /// <summary>
        /// Context > Plan To > Level N
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void planToMenuItem_Click(object sender, EventArgs e)
        {
            var menu      = (ToolStripMenuItem)sender;
            var operation = (IPlanOperation)menu.Tag;

            PlanHelper.SelectPerform(operation);
        }
示例#4
0
        /// <summary>
        /// Shared context menu - add ship/item to plan
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsAddEntityToPlan_Click(object sender, EventArgs e)
        {
            var entity    = (Item)tvEntity.SelectedNode.Tag;
            var operation = m_planWindow.Plan.TryAddSet(entity.Prerequisites, entity.Name);

            PlanHelper.Perform(operation);
        }
示例#5
0
        /// <summary>
        /// Listview, listbox, and tree view contexts menu > Plan to > Plan to N
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void planToLevelMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem levelItem = (ToolStripMenuItem)sender;
            var operation = levelItem.Tag as IPlanOperation;

            PlanHelper.SelectPerform(operation);
        }
        /// <summary>
        /// Updates the combo on the top right, to change the planned level.
        /// </summary>
        private void UpdatePlannedLevel()
        {
            // Not visible
            if (m_selectedSkill == null)
            {
                return;
            }

            // Toolbar > Planned to... dropdown menu
            bool enabled = false;

            enabled           |= PlanHelper.UpdatesRegularPlanToMenu(planTo0Menu, m_plan, m_selectedSkill, 0);
            enabled           |= PlanHelper.UpdatesRegularPlanToMenu(planTo1Menu, m_plan, m_selectedSkill, 1);
            enabled           |= PlanHelper.UpdatesRegularPlanToMenu(planTo2Menu, m_plan, m_selectedSkill, 2);
            enabled           |= PlanHelper.UpdatesRegularPlanToMenu(planTo3Menu, m_plan, m_selectedSkill, 3);
            enabled           |= PlanHelper.UpdatesRegularPlanToMenu(planTo4Menu, m_plan, m_selectedSkill, 4);
            enabled           |= PlanHelper.UpdatesRegularPlanToMenu(planTo5Menu, m_plan, m_selectedSkill, 5);
            planToMenu.Enabled = enabled;

            // Toolbar > "Planned to" label
            int level = m_plan.GetPlannedLevel(m_selectedSkill);

            planToMenu.Text = (level == 0 ? "Plan To (none)..." :
                               String.Format(CultureConstants.DefaultCulture, "Plan To Level {0}...", Skill.GetRomanForInt(level)));
        }
示例#7
0
        /// <summary>
        /// Updates the combo on the top right, to change the planned level.
        /// </summary>
        private void UpdatePlannedLevel()
        {
            // Not visible
            if (m_selectedSkill == null) return;

            // Toolbar > Planned to... dropdown menu
            bool enabled = false;
            enabled |= PlanHelper.UpdatesRegularPlanToMenu(planTo0Menu, m_plan, m_selectedSkill, 0);
            enabled |= PlanHelper.UpdatesRegularPlanToMenu(planTo1Menu, m_plan, m_selectedSkill, 1);
            enabled |= PlanHelper.UpdatesRegularPlanToMenu(planTo2Menu, m_plan, m_selectedSkill, 2);
            enabled |= PlanHelper.UpdatesRegularPlanToMenu(planTo3Menu, m_plan, m_selectedSkill, 3);
            enabled |= PlanHelper.UpdatesRegularPlanToMenu(planTo4Menu, m_plan, m_selectedSkill, 4);
            enabled |= PlanHelper.UpdatesRegularPlanToMenu(planTo5Menu, m_plan, m_selectedSkill, 5);
            planToMenu.Enabled = enabled;

            // Toolbar > "Planned to" label
            int level = m_plan.GetPlannedLevel(m_selectedSkill);
            if (level == 0)
            {
                planToMenu.Text = "Plan To (none)...";
            }
            else
            {
                planToMenu.Text = "Plan To Level " + Skill.GetRomanForInt(level) + "...";
            }
        }
示例#8
0
        /// <summary>
        /// Treeview's context menu > Plan "(selection)".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmAddToPlan_Click(object sender, EventArgs e)
        {
            CertificateLevel cert = treeView.SelectedNode.Tag as CertificateLevel;
            IPlanOperation   operation;

            if (cert != null)
            {
                operation = m_plan.TryPlanTo(cert);
            }
            else
            {
                SkillLevel prereq = (SkillLevel)treeView.SelectedNode.Tag;
                operation = m_plan.TryPlanTo(prereq.Skill, prereq.Level);
            }

            if (operation == null)
            {
                return;
            }

            PlanWindow planWindow = ParentForm as PlanWindow;

            if (planWindow == null)
            {
                return;
            }

            PlanHelper.SelectPerform(new PlanToOperationWindow(operation), planWindow, operation);
        }
        /// <summary>
        /// Adds the required skills to the Plan specified by the Plan property.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlan_Click(object sender, EventArgs e)
        {
            var operation = m_plan.TryAddSet(m_skillsToAdd, m_loadoutName);

            PlanHelper.Perform(operation);
            UpdatePlanStatus();
        }
示例#10
0
        /// <summary>
        /// Context menu opening, updates the "plan to" menus
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void contextMenu_Opening(object sender, CancelEventArgs e)
        {
            if (tvSkillList.SelectedNode == null)
            {
                planToMenu.Enabled = false;

                // Update "show in..." menu
                showInMenuSeparator.Visible     = false;
                showInSkillBrowserMenu.Visible  = false;
                showInSkillExplorerMenu.Visible = false;
            }
            else
            {
                planToMenu.Enabled              = true;
                showInMenuSeparator.Visible     = true;
                showInSkillBrowserMenu.Visible  = true;
                showInSkillExplorerMenu.Visible = true;

                // "Plan to N" menus
                var skillLevel = (SkillLevel)tvSkillList.SelectedNode.Tag;
                var skill      = skillLevel.Skill;
                for (int i = 0; i <= 5; i++)
                {
                    PlanHelper.UpdatesRegularPlanToMenu(planToMenu.DropDownItems[i], m_plan, skill, i);
                }
            }
        }
示例#11
0
        /// <summary>
        /// Event handler method for Add Skills button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddSkills_Click(object sender, EventArgs e)
        {
            // Add skills to plan
            var operation = m_plan.TryAddSet(m_object.Prerequisites.Where(x => x.Activity.Equals(Activity)), m_object.Name);

            PlanHelper.Perform(operation);

            // Refresh display to reflect plan changes
            UpdateDisplay();
        }
示例#12
0
        /// <summary>
        /// Shared context menu - add ship/item/blueprint to plan.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsAddEntityToPlan_Click(object sender, EventArgs e)
        {
            Item entity = GetSelectedItem();

            if (entity == null)
            {
                return;
            }

            List <string>  listOfActivities = GetSelectedItemActivities(entity);
            IPlanOperation operation        = m_planWindow.Plan.TryAddSet(entity.Prerequisites.Where(x => listOfActivities.Contains(x.Activity.GetDescription())), entity.Name);

            PlanHelper.Perform(operation);
        }
        /// <summary>
        /// Treeview's context menu > Plan "(selection)"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmAddToPlan_Click(object sender, EventArgs e)
        {
            var cert = this.treeView.SelectedNode.Tag as Certificate;

            if (cert != null)
            {
                var operation = m_plan.TryPlanTo(cert);
                PlanHelper.SelectPerform(operation);
            }
            else
            {
                var prereq    = (SkillLevel)this.treeView.SelectedNode.Tag;
                var operation = m_plan.TryPlanTo(prereq.Skill, prereq.Level);
                PlanHelper.SelectPerform(operation);
            }
        }
示例#14
0
        /// <summary>
        /// Context menu opening, updates the "plan to" menus
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void contextMenu_Opening(object sender, CancelEventArgs e)
        {
            if (tvSkillList.SelectedNode == null)
            {
                e.Cancel = true;
                return;
            }

            // "Plan to N" menus
            var skillLevel = (SkillLevel)tvSkillList.SelectedNode.Tag;
            var skill      = skillLevel.Skill;

            for (int i = 1; i <= 5; i++)
            {
                PlanHelper.UpdatesRegularPlanToMenu(planToMenu.DropDownItems[i - 1], m_plan, skill, i);
            }
        }
示例#15
0
        /// <summary>
        /// When the list's context menu opens, we update the menus status
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmListSkills_Opening(object sender, CancelEventArgs e)
        {
            if (SelectedSkill == null)
            {
                e.Cancel = true;
                return;
            }

            // "Plan to N" menus
            for (int i = 0; i <= 5; i++)
            {
                PlanHelper.UpdatesRegularPlanToMenu(cmiLvPlanTo.DropDownItems[i], m_plan, SelectedSkill, i);
            }

            // "Show in skill browser"
            showInSkillBrowserListMenu.Visible = !m_hostedInSkillBrowser;
        }
示例#16
0
 /// <summary>
 /// Whenever the user right-click the skill tree on the left, we display the context menu.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void skillTreeDisplay_SkillClicked(object sender, SkillClickedEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         bool isPlanned = false;
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo0, m_plan, e.Skill, 0);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo1, m_plan, e.Skill, 1);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo2, m_plan, e.Skill, 2);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo3, m_plan, e.Skill, 3);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo4, m_plan, e.Skill, 4);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo5, m_plan, e.Skill, 5);
         cmsSkillContext.Show(skillTreeDisplay, e.Location);
     }
     else
     {
         this.SelectedSkill = e.Skill;
     }
 }
示例#17
0
        /// <summary>
        /// Context menu > Plan to N / Remove.
        /// Toolbar > Plan to... > Level N / Remove.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void planToMenu_Click(object sender, EventArgs e)
        {
            IPlanOperation operation = ((ToolStripMenuItem)sender).Tag as IPlanOperation;

            if (operation == null)
            {
                return;
            }

            PlanWindow planWindow = ParentForm as PlanWindow;

            if (planWindow == null)
            {
                return;
            }

            PlanHelper.SelectPerform(new PlanToOperationWindow(operation), planWindow, operation);
        }
示例#18
0
        /// <summary>
        /// When the user clicks the node, we select it and checks whether we must display the context menu.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void tvSkills_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            this.tvSkills.SelectedNode = e.Node;
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            // Do not display menu for non-skill nodes
            var skill = e.Node.Tag as Skill;

            if (skill == null)
            {
                return;
            }

            // Updates selection
            tvSkills.SelectedNode = e.Node;

            // Update the "plan to X" menus
            tsAddPlan.Enabled = false;
            if (skill.Level < 5)
            {
                tsAddPlan.Enabled = true;
            }
            for (int i = 1; i <= 5; i++)
            {
                PlanHelper.UpdatesRegularPlanToMenu(tsAddPlan.DropDownItems[i - 1], m_planWindow.Plan, skill, i);
            }

            // Update the "show prerequisites" menu
            if (skill.ArePrerequisitesMet)
            {
                tsShowPrereqs.Enabled = false;
            }
            else
            {
                tsShowPrereqs.Enabled = true;
            }

            // Show menu
            cmSkills.Show(tvSkills, e.Location);
        }
示例#19
0
        /// <summary>
        /// Event handler method for Add Certs button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddCerts_Click(object sender, EventArgs e)
        {
            // Add Certificates to plan
            List <StaticSkillLevel> skillsToAdd = new List <StaticSkillLevel>();

            foreach (TreeNode certificate in tvCertList.Nodes)
            {
                var cert   = certificate.Tag as Certificate;
                var skills = cert.StaticData.AllTopPrerequisiteSkills;
                skillsToAdd.AddRange(skills);
            }

            var operation = m_plan.TryAddSet(skillsToAdd, m_object.Name);

            PlanHelper.Perform(operation);

            // Refresh display to reflect plan changes
            UpdateDisplay();
        }
        /// <summary>
        /// When the user clicks the "plan" button, we add the prerqs to the plan and refresh the display.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlan_Click(object sender, EventArgs e)
        {
            IPlanOperation operation = m_plan.TryAddSet(m_prerequisites, m_selectedLoadout.Name);

            if (operation == null)
            {
                return;
            }

            PlanWindow planWindow = PlanWindow.ShowPlanWindow(plan: operation.Plan);

            if (planWindow == null)
            {
                return;
            }

            PlanHelper.Perform(new PlanToOperationWindow(operation), planWindow);
            UpdatePlanningControls();
        }
示例#21
0
        /// <summary>
        /// When the user clicks the node, we select it and checks whether we must display the context menu.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void tvSkills_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            // Updates selection
            tvSkills.SelectedNode = e.Node;

            // Display menu only when we access the skill explorer through a plan
            if (m_planWindow == null)
            {
                return;
            }

            // Do not display menu for non-skill nodes
            Skill skill = GetSelectedSkill();

            if (skill == null)
            {
                return;
            }

            // Update the "plan to X" menus
            tsAddPlan.Enabled = false;
            if (skill.Level < 5)
            {
                tsAddPlan.Enabled = true;
            }

            for (int i = 1; i <= 5; i++)
            {
                PlanHelper.UpdatesRegularPlanToMenu(tsAddPlan.DropDownItems[i - 1], m_planWindow.Plan, skill, i);
            }

            // Update the "show prerequisites" menu
            tsShowSkillPrereqs.Enabled = !skill.ArePrerequisitesMet;

            // Show menu
            cmSkills.Show(tvSkills, e.Location);
        }
示例#22
0
        /// <summary>
        /// Adds the required skills to the Plan specified by the Plan property.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlan_Click(object sender, EventArgs e)
        {
            IPlanOperation operation = m_plan.TryAddSet(m_skillsToAdd, m_loadoutInfo.Loadouts.First().Name);

            if (operation == null)
            {
                return;
            }

            PlanWindow planWindow = PlanWindow.ShowPlanWindow(plan: operation.Plan);

            if (planWindow == null)
            {
                return;
            }

            PlanHelper.Perform(new PlanToOperationWindow(operation), planWindow);
            planWindow.ShowPlanEditor();
            UpdatePlanStatus();
        }
示例#23
0
        /// <summary>
        /// Event handler method for Add Skills button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddSkills_Click(object sender, EventArgs e)
        {
            // Add skills to plan
            IPlanOperation operation = m_plan.TryAddSet(m_object.Prerequisites.Where(x => x.Activity.Equals(Activity)),
                                                        m_object.Name);

            if (operation == null)
            {
                return;
            }

            PlanWindow planWindow = ParentForm as PlanWindow;

            if (planWindow == null)
            {
                return;
            }

            PlanHelper.Perform(new PlanToOperationWindow(operation), planWindow);

            // Refresh display to reflect plan changes
            UpdateDisplay();
        }
示例#24
0
        /// <summary>
        /// When the tree's context menu opens, we update the submenus' statuses.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmSkills_Opening(object sender, CancelEventArgs e)
        {
            Skill skill = null;
            var   node  = tvItems.SelectedNode;

            if (node != null)
            {
                skill = tvItems.SelectedNode.Tag as Skill;
            }

            tsSeparatorBrowser.Visible = (node != null);

            // "Show in skill browser/explorer"
            showInSkillExplorerMenu.Visible = (skill != null);
            showInSkillBrowserMenu.Visible  = (skill != null && !m_hostedInSkillBrowser);

            // "Collapse" and "Expand" menus
            cmiCollapseSelected.Visible = (skill == null && node != null && node.IsExpanded);
            cmiExpandSelected.Visible   = (skill == null && node != null && !node.IsExpanded);

            cmiExpandSelected.Text   = (skill == null && node != null && !node.IsExpanded ? String.Format("Expand {0}", node.Text) : String.Empty);
            cmiCollapseSelected.Text = (skill == null && node != null && node.IsExpanded ? String.Format("Collapse {0}", node.Text) : String.Empty);

            // "Expand All" and "Collapse All" menus
            cmiCollapseAll.Enabled = cmiCollapseAll.Visible = m_allExpanded;
            cmiExpandAll.Enabled   = cmiExpandAll.Visible = !cmiCollapseAll.Enabled;

            // "Plan to N" menus
            cmiPlanTo.Enabled = (skill != null && skill.Level < 5);
            if (skill != null)
            {
                for (int i = 0; i <= 5; i++)
                {
                    PlanHelper.UpdatesRegularPlanToMenu(cmiPlanTo.DropDownItems[i], m_plan, SelectedSkill, i);
                }
            }
        }
示例#25
0
        private void tsPlanToImproved_Click(object sender, EventArgs e)
        {
            var operation = m_plan.TryPlanTo(this.certSelectCtl.SelectedCertificateClass[CertificateGrade.Improved]);

            PlanHelper.PerformSilently(operation);
        }
示例#26
0
        /// <summary>
        /// Handles the Click event of the tsPlanToElite 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 tsPlanToElite_Click(object sender, EventArgs e)
        {
            var operation = m_plan.TryPlanTo(certSelectCtl.SelectedCertificateClass[CertificateGrade.Elite]);

            PlanHelper.SelectPerform(operation);
        }
示例#27
0
 /// <summary>
 /// Context menu > Plan to N / Remove
 /// Toolbar > Plan to... > Level N / Remove
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void planToMenu_Click(object sender, EventArgs e)
 {
     var operation = ((ToolStripMenuItem)sender).Tag as IPlanOperation;
     PlanHelper.PerformSilently(operation);
 }
示例#28
0
        private void tsmLevel4_Click(object sender, EventArgs e)
        {
            var operation = m_plan.TryPlanTo(this.SelectedCertificateClass[CertificateGrade.Elite]);

            PlanHelper.PerformSilently(operation);
        }
        /// <summary>
        /// Context menu > Plan to > Improved
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmLevel3_Click(object sender, EventArgs e)
        {
            var operation = m_plan.TryPlanTo(SelectedCertificateClass[CertificateGrade.Improved]);

            PlanHelper.SelectPerform(operation);
        }
示例#30
0
        /// <summary>
        /// Skill context menu > Plan to level
        /// theres a menu item for each level, each one is tagged with a
        /// string representing level number.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsAddLevel_Click(object sender, EventArgs e)
        {
            IPlanOperation operation = ((ToolStripMenuItem)sender).Tag as IPlanOperation;

            PlanHelper.SelectPerform(operation);
        }