CodeTV.WinLIRCMappingEditorForm.buttonAddMapping_Click C# (CSharp) Method

buttonAddMapping_Click() private method

private buttonAddMapping_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void buttonAddMapping_Click(object sender, EventArgs e)
        {
            MainForm.CommandName commandName = (MainForm.CommandName)Enum.Parse(typeof(MainForm.CommandName), this.comboBoxApplicationCommand.SelectedItem.ToString());
            string winLIRCCommand = this.textBoxWinLIRCCommand.Text;
            if (this.winLIRCcommandMapping.ContainsKey(winLIRCCommand))
            {
                foreach (ListViewItem lvi in this.listViewCommandMapping.Items)
                {
                    if (lvi.Text == winLIRCCommand)
                    {
                        lvi.SubItems[1].Text = commandName.ToString();
                        break;
                    }
                }
            }
            else
            {
                ListViewItem lvi = new ListViewItem(winLIRCCommand);
                lvi.SubItems.Add(commandName.ToString());
                this.listViewCommandMapping.Items.Add(lvi);
            }
            this.winLIRCcommandMapping[winLIRCCommand] = commandName;
        }