Advertisement
Guest User

Untitled

a guest
May 27th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.21 KB | None | 0 0
  1.  /// <summary>
  2.         /// Private helper method for list view button click
  3.         /// </summary>
  4.         /// <param name="sender"></param>
  5.         /// <param name="e"></param>
  6.         private void OnButtonActionClick(object sender, ListViewColumnMouseEventArgs e)
  7.         {
  8.             //Check if com is selected
  9.             if (comboBox_available_serialPorts.SelectedIndex == -1)
  10.             {
  11.                 MessageBox.Show("Please Select COM-port.");
  12.                 return;
  13.             }
  14.             //Check if baud is selected
  15.             else if(comboBox_baudRate.SelectedIndex == -1)
  16.             {
  17.                 MessageBox.Show("Please Select Baudrate.");
  18.                 return;
  19.             }
  20.             AppAction current = new AppAction(availableApparats[e.Item.Index]);
  21.             if (current.SelectedOnOff)
  22.             {
  23.                 onOffButton.Visible = true;
  24.                 onOffButton.Enabled = true;
  25.                 //Sets the text of the on of button
  26.                 onOffButton.Text = (isPortOn(availableApparats[e.Item.Index].Port) ? "Turn Off" : "Turn On");
  27.             }
  28.             else
  29.             {
  30.                 onOffButton.Visible = false;
  31.                 onOffButton.Enabled = false;
  32.             }
  33.             if (current.SelectedDimmer)
  34.             {
  35.                 dimmerScroll.Visible = true;
  36.                 dimmerText.Visible = true;
  37.                 //Sets the dimmerscroll value
  38.                 dimmerScroll.Value = current.SelectedDimmerValue;
  39.             }
  40.             else
  41.             {
  42.                 dimmerScroll.Visible = false;
  43.                 dimmerText.Visible = false;
  44.             }
  45.             //Set the current apparat port
  46.             currentApparatPort = availableApparats[e.Item.Index].Port;
  47.             //Set the current apparat functionality
  48.             currentApparatFunc = availableApparats[e.Item.Index].Functionality;
  49.             //Set the label for current apparat
  50.             currentApparatLabel.Text = availableApparats[e.Item.Index].Name;
  51.             //Change page
  52.             ApparatMenu.Enabled = false;
  53.             AddMenu.Enabled = false;
  54.             Settings.Enabled = true;
  55.             mainView.SelectTab(Settings);
  56.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement