private void Inti(MenuItemID OptionID, string OptionName, Type EnumType, bool Expanded) { if (!EnumType.IsEnum) { throw new ArgumentException("EnumType must be an enumerated type"); } this.EnumType = EnumType; this.OptName = OptionName; this.ItemID = OptionID; this.OptType = Expanded ? OptionType.Expanded : OptionType.Custom; this.OptState = (int)Enum.GetValues(EnumType).GetValue(0); }
/// <summary> /// To inti normal and sub option /// </summary> public MenuItem(MenuItemID OptionID, string OptionName, Type EnumType, bool Expanded = false) { Inti(OptionID, OptionName, EnumType, Expanded); }