public void AddCommand <T>(string text, string key = null, PanelWidths width = PanelWidths.Small) where T : UserControl, new() { _commands.Add(new CommandInfo <T> { Key = key ?? text, Text = text, Width = (int)width }); }
public void AddCommand <T>(string text, string key = null, PanelWidths width = PanelWidths.Small) where T : UserControl, new() { CommandInfo <T> cmd = new CommandInfo <T>() { Key = key ?? text, Text = text, Width = (int)width }; if (null == this.Commands.FirstOrDefault(c => c.Key.Equals(cmd.Key))) { this.Commands.Add(cmd); } }