private void CmdListView_SelectedIndexChanged(object senderm, EventArgs e) { warningLabel.Text = ""; if (CmdListView.SelectedItems.Count != 0) { CmdListView.SelectedItems[0].BackColor = Color.SkyBlue; nameMaskedTextBox.Text = CmdListView.SelectedItems[0].SubItems[1].Text.Substring(2); string name = CmdListView.SelectedItems[0].SubItems[1].Text; for (int i = 0; i < local_cmd.Count; i++) { if (string.Compare(local_cmd[i].name, name) == 0) { current_trigger = local_cmd[i]; update_triggers(); break; } } } if (last == null) { last = CmdListView.SelectedItems[0]; } else if (CmdListView.SelectedItems.Count != 0) { last.BackColor = Color.White; last = CmdListView.SelectedItems[0]; } }
public ME_Trigger Copy() { ME_Trigger ret = new ME_Trigger(); ret.name = this.name; ret.used = this.used; ret.trigger_method = this.trigger_method; ret.auto_method = this.auto_method; ret.keyboard_key = this.keyboard_key; ret.keyboard_Type = this.keyboard_Type; ret.bt_key = this.bt_key; ret.bt_mode = this.bt_mode; ret.wifi602_key = this.wifi602_key; ret.ps2_key = this.ps2_key; ret.ps2_type = this.ps2_type; ret.analog_pin = this.analog_pin; ret.analog_cond = this.analog_cond; ret.analog_value = this.analog_value; ret.esp8266_key = this.esp8266_key; ret.esp8266_mode = this.esp8266_mode; for (int i = 0; i < this.acc_Settings.Length; i++) { ret.acc_Settings[i] = this.acc_Settings[i]; } return(ret); }
private void addButton_Click(object sender, EventArgs e) { if (checkName() == true) { cmd_num = cmd_num + 1; string[] row = { cmd_num.ToString(), "c_" + nameMaskedTextBox.Text }; var varItem = new ListViewItem(row); CmdListView.Items.Add(varItem); warningLabel.Text = ""; varItem.Selected = true; ME_Trigger tr = new ME_Trigger(); tr.name = row[1]; local_cmd.Add(tr); current_trigger = tr; update_triggers(); enableTriggerGroup(Always_groupBox); } }
public void SetAttrBy(ME_Trigger tr) { this.name = tr.name; this.used = tr.used; this.trigger_method = tr.trigger_method; this.auto_method = tr.auto_method; this.keyboard_key = tr.keyboard_key; this.keyboard_Type = tr.keyboard_Type; this.bt_key = tr.bt_key; this.bt_mode = tr.bt_mode; this.wifi602_key = tr.wifi602_key; this.ps2_key = tr.ps2_key; this.ps2_type = tr.ps2_type; this.analog_pin = tr.analog_pin; this.analog_cond = tr.analog_cond; this.analog_value = tr.analog_value; this.esp8266_key = tr.esp8266_key; this.esp8266_mode = tr.esp8266_mode; for (int i = 0; i < this.acc_Settings.Length; i++) { this.acc_Settings[i] = tr.acc_Settings[i]; } }
private void update_triggers() { if (current_trigger != null) { MotionConfig.Enabled = true; } else { return; } ME_Trigger tr = current_trigger; if (tr.trigger_method == (int)mtest_method.always) { enableTriggerGroup(Always_groupBox); Always_radioButton.Checked = true; } else if (tr.trigger_method == (int)mtest_method.keyboard) { enableTriggerGroup(Keyboard_groupBox); Keyboard_radioButton.Checked = true; } else if (tr.trigger_method == (int)mtest_method.bluetooth) { enableTriggerGroup(bt_groupBox); bt_radioButton.Checked = true; } else if (tr.trigger_method == (int)mtest_method.ps2) { enableTriggerGroup(ps2_groupBox); ps2_radioButton.Checked = true; } else if (tr.trigger_method == (int)mtest_method.acc) { enableTriggerGroup(acc_groupBox); acc_radioButton.Checked = true; } else if (tr.trigger_method == (int)mtest_method.wifi602) { enableTriggerGroup(wifi602_groupBox); wifi602_radioButton.Checked = true; } else if (tr.trigger_method == (int)mtest_method.analog) { enableTriggerGroup(analog_groupBox); analog_radioButton.Checked = true; } else if (tr.trigger_method == (int)mtest_method.esp8266) { enableTriggerGroup(ESP8266_groupBox); ESP8266_radioButton.Checked = true; } if (tr.auto_method == (int)auto_method.on) { AlwaysOn.Checked = true; } else if (tr.auto_method == (int)auto_method.off) { AlwaysOff.Checked = true; } else if (tr.auto_method == (int)auto_method.title) { TitleMotion.Checked = true; } KeyboardCombo.SelectedIndex = tr.keyboard_key; KeyboardTypeCombo.SelectedIndex = tr.keyboard_Type; btKeyText.Text = tr.bt_key; btModeCombo.Text = tr.bt_mode; btPortCombo.Text = gs.bt_port; btBaudCombo.Text = gs.bt_baud; wifi602PortCombo.Text = gs.wifi602_port; wifi602KeyCombo.SelectedIndex = tr.wifi602_key; ps2DATCombo.Text = gs.ps2pins[0]; ps2CMDCombo.Text = gs.ps2pins[1]; ps2ATTCombo.Text = gs.ps2pins[2]; ps2CLKCombo.Text = gs.ps2pins[3]; ps2KeyCombo.Text = tr.ps2_key; ps2TypeCombo.SelectedIndex = tr.ps2_type; accLXText.Text = tr.acc_Settings[0].ToString(); accHXText.Text = tr.acc_Settings[1].ToString(); accLYText.Text = tr.acc_Settings[2].ToString(); accHYText.Text = tr.acc_Settings[3].ToString(); accLZText.Text = tr.acc_Settings[4].ToString(); accHZText.Text = tr.acc_Settings[5].ToString(); accDurationText.Text = tr.acc_Settings[6].ToString(); analogCondCombo.SelectedIndex = tr.analog_cond; analogPinCombo.SelectedIndex = tr.analog_pin; analogValueText.Text = tr.analog_value.ToString(); ESP8266KeyText.Text = tr.esp8266_key; ESP8266ModeCombo.Text = tr.esp8266_mode; ESP8266BaudCombo.Text = gs.esp8266_baud; ESP8266PortCombo.Text = gs.esp8266_port; ESP8266CHPDCombo.Text = gs.esp8266_chpd; }