/// <summary> /// When a checkbox state changed, we update the controls list. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void clbColumns_ItemCheck(object sender, ItemCheckEventArgs e) { bool isChecked = e.NewValue == CheckState.Checked; // Gets the key of the modified column string header = (string)clbColumns.Items[e.Index]; int key = AllKeys.First(x => GetHeader(x) == header); // Gets the column for this key IColumnSettings column = m_columns.First(x => x.Key == key); column.Visible = isChecked; }
public static KeySignature GetKey(string name) { name = name.ToUpperInvariant().Replace("-", "").Replace("MAJOR", "") .Replace("MINOR", "m").Replace("FLAT", "♭").Replace("#", "♯") .Replace("SHARP", "♯"); if (name.StartsWith("BB")) { name = name.Replace("BB", "B♭"); } else if (name.Substring(1).Contains('B')) { name = name.Replace('B', '♭'); } if (name.Last() == 'm') { name = name.Trim('m'); return(AllKeys.First(k => k.MinorName.ToUpperInvariant().Equals(name.ToUpperInvariant()))); } return(AllKeys.First(k => k.MajorName.ToUpperInvariant().Equals(name.ToUpperInvariant()))); }