/// <summary> /// Create a node from a prerequisite certificate. /// </summary> /// <param name="certLevel">The cert level.</param> /// <returns></returns> private static TreeNode CreateNode(CertificateLevel certLevel) { TreeNode node = new TreeNode { Text = certLevel.ToString(), Tag = certLevel }; foreach (SkillLevel prereqSkill in certLevel.PrerequisiteSkills) { node.Nodes.Add(CreateNode(prereqSkill)); } return(node); }
/// <summary> /// Updates eligibility label and planning menus. /// </summary> private void UpdateEligibility() { foreach (ToolStripItem control in tspControl.Items) { control.Visible = m_plan != null; } // Not visible if (m_selectedCertificate == null || m_plan == null) { return; } // First we search the highest eligible certificate level after this plan IList <CertificateLevel> eligibleCertLevel = m_selectedCertificate.Certificate.AllLevel .TakeWhile(cert => m_plan.WillGrantEligibilityFor(cert)).ToList(); CertificateLevel lastEligibleCertLevel = null; if (!eligibleCertLevel.Any()) { tslbEligible.Text = @"(none)"; } else { lastEligibleCertLevel = eligibleCertLevel.Last(); tslbEligible.Text = lastEligibleCertLevel.ToString(); tslbEligible.Text += m_selectedCertificate.HighestTrainedLevel == null ? " (improved from \"none\")" : (int)lastEligibleCertLevel.Level > (int)m_selectedCertificate.HighestTrainedLevel.Level ? $" (improved from \"{m_selectedCertificate.HighestTrainedLevel}\")" : @" (no change)"; } planToLevel.Enabled = false; // "Plan to N" menus for (int i = 1; i <= 5; i++) { planToLevel.Enabled |= UpdatePlanningMenuStatus(planToLevel.DropDownItems[i - 1], m_selectedCertificate.Certificate.GetCertificateLevel(i), lastEligibleCertLevel); } }