private void BAddActionClick(object sender, EventArgs e) { foreach (var item in Enum.GetValues(typeof(ActionType))) { if (cbAddAction.Text.ToUpper().Equals(ApplicationInput.FriendlyActionName((ActionType)item).ToUpper())) { _button.Value = _button.Value.AddAction((ActionType)item); break; } } }
public CecButtonConfigUI(CecButtonConfigItem button) { _button = button; InitializeComponent(); var keys = Enum.GetValues(typeof(WindowsAPI.VirtualKeyCode)); string[] friendlyNames = new string[keys.Length]; for (int i = 0; i < keys.Length; i++) { friendlyNames[i] = WindowsAPI.GetVirtualKeyName((WindowsAPI.VirtualKeyCode)keys.GetValue(i)); } Array.Sort(friendlyNames); foreach (var item in friendlyNames) { cbAddKey.Items.Add(item); } button.SettingChanged += delegate { _lastSelectedText = 0; tbAction.Text = button.Value.AsFriendlyString().Trim(); }; lButtonName.Text = button.Label.Text; tbAction.Text = button.Value.AsFriendlyString().Trim(); //TODO cbAddAction.Items.Add(ApplicationInput.FriendlyActionName(ActionType.CloseControllerApplication)); cbAddAction.Items.Add(ApplicationInput.FriendlyActionName(ActionType.StartApplication)); // take the icon of the main window ComponentResourceManager resources = new ComponentResourceManager(typeof(CECTray)); Icon = resources.GetObject("$this.Icon") as Icon; }