Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Private helper method for list view button click
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void OnButtonActionClick(object sender, ListViewColumnMouseEventArgs e)
- {
- //Check if com is selected
- if (comboBox_available_serialPorts.SelectedIndex == -1)
- {
- MessageBox.Show("Please Select COM-port.");
- return;
- }
- //Check if baud is selected
- else if(comboBox_baudRate.SelectedIndex == -1)
- {
- MessageBox.Show("Please Select Baudrate.");
- return;
- }
- AppAction current = new AppAction(availableApparats[e.Item.Index]);
- if (current.SelectedOnOff)
- {
- onOffButton.Visible = true;
- onOffButton.Enabled = true;
- //Sets the text of the on of button
- onOffButton.Text = (isPortOn(availableApparats[e.Item.Index].Port) ? "Turn Off" : "Turn On");
- }
- else
- {
- onOffButton.Visible = false;
- onOffButton.Enabled = false;
- }
- if (current.SelectedDimmer)
- {
- dimmerScroll.Visible = true;
- dimmerText.Visible = true;
- //Sets the dimmerscroll value
- dimmerScroll.Value = current.SelectedDimmerValue;
- }
- else
- {
- dimmerScroll.Visible = false;
- dimmerText.Visible = false;
- }
- //Set the current apparat port
- currentApparatPort = availableApparats[e.Item.Index].Port;
- //Set the current apparat functionality
- currentApparatFunc = availableApparats[e.Item.Index].Functionality;
- //Set the label for current apparat
- currentApparatLabel.Text = availableApparats[e.Item.Index].Name;
- //Change page
- ApparatMenu.Enabled = false;
- AddMenu.Enabled = false;
- Settings.Enabled = true;
- mainView.SelectTab(Settings);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement