private void cboName_SelectedIndexChanged(object sender, EventArgs e) { string splitDescription = cboName.SelectedValue.ToString(); SplitName split = GetEnumValue <SplitName>(splitDescription); Split = split.ToString(); if (splitDescription.IndexOf("(Boss)") < 0 && splitDescription.IndexOf("(Run 'n Gun)") < 0) { cboGrade.SelectedItem = "Any"; cboDifficulty.SelectedItem = "Any"; cboGrade.Visible = false; cboDifficulty.Visible = false; btnRemove.Location = new System.Drawing.Point(274, 2); } else if (splitDescription.IndexOf("(Run 'n Gun)") > 0) { cboDifficulty.SelectedItem = "Any"; btnRemove.Location = new System.Drawing.Point(331, 2); cboGrade.Visible = true; cboDifficulty.Visible = false; } else { btnRemove.Location = new System.Drawing.Point(399, 2); cboGrade.Visible = true; cboDifficulty.Visible = true; } MemberInfo info = typeof(SplitName).GetMember(split.ToString())[0]; DescriptionAttribute description = (DescriptionAttribute)info.GetCustomAttributes(typeof(DescriptionAttribute), false)[0]; ToolTipAttribute tooltip = (ToolTipAttribute)info.GetCustomAttributes(typeof(ToolTipAttribute), false)[0]; ToolTips.SetToolTip(cboName, tooltip.ToolTip); }
private void cboName_SelectedIndexChanged(object sender, EventArgs e) { string splitDescription = cboName.SelectedValue.ToString(); SplitName split = GetSplitName(splitDescription); Split = split.ToString(); MemberInfo info = typeof(SplitName).GetMember(split.ToString())[0]; DescriptionAttribute description = (DescriptionAttribute)info.GetCustomAttributes(typeof(DescriptionAttribute), false)[0]; ToolTipAttribute tooltip = (ToolTipAttribute)info.GetCustomAttributes(typeof(ToolTipAttribute), false)[0]; ToolTips.SetToolTip(cboName, tooltip.ToolTip); }
public void LoadSettings() { isLoading = true; this.flowMain.SuspendLayout(); for (int i = flowMain.Controls.Count - 1; i > 0; i--) { flowMain.Controls.RemoveAt(i); } for (int i = 0; i < Splits.Count; i++) { SplitName split = Splits[i]; MemberInfo info = typeof(SplitName).GetMember(split.ToString())[0]; DescriptionAttribute description = (DescriptionAttribute)info.GetCustomAttributes(typeof(DescriptionAttribute), false)[0]; SteamWorldSplitSettings setting = new SteamWorldSplitSettings(); setting.cboName.DataSource = GetAvailableSplits(); setting.cboName.Text = description.Description; SetSplitDescription(setting, i); AddHandlers(setting); flowMain.Controls.Add(setting); } isLoading = false; this.flowMain.ResumeLayout(true); }
private void cboType_SelectedIndexChanged(object sender, EventArgs e) { string splitDescription = cboSplit.SelectedValue.ToString(); SplitName split = GetEnumValue <SplitName>(splitDescription); MemberInfo[] infos = typeof(SplitName).GetMember(split.ToString()); DescriptionAttribute[] descriptions = null; if (infos.Length > 0) { descriptions = (DescriptionAttribute[])infos[0].GetCustomAttributes(typeof(DescriptionAttribute), false); } if (descriptions != null && descriptions.Length > 0) { ToolTips.SetToolTip(cboSplit, descriptions[0].Description); } else { ToolTips.SetToolTip(cboSplit, string.Empty); } }