private void LoadGpioValue(TypeEnum type) { switch (type) { case TypeEnum.Q300P: char[] val_q300p = Q300P.ReadGpioValues(gpio); log_box.Text += "\r\n" + type.ToString() + " GPIO Pin polarity: " + string.Join("", val_q300p); FormatGpioValue(val_q300p); break; case TypeEnum.Q500G6: char[] val_q500g6 = Q500G6.ReadGpioValues(gpio); log_box.Text += "\r\n" + type.ToString() + " GPIO Pin polarity: " + string.Join("", val_q500g6); FormatGpioValue(val_q500g6); break; case TypeEnum.Q600P: char[] val_q600p = Q600P.ReadGpioValues(gpio); log_box.Text += "\r\n" + type.ToString() + " GPIO Pin polarity: " + string.Join("", val_q600p); FormatGpioValue(val_q600p); break; default: break; } }
private void LoadGpioModel(TypeEnum type) { switch (type) { case TypeEnum.Q300P: char[] models_q300p = Q300P.ReadGpioModel(gpio); log_box.Text += "\r\n" + type.ToString() + " GPIO Output/Input: " + string.Join("", models_q300p); FormatGpioModel(models_q300p); break; case TypeEnum.Q500G6: char[] models_q500g6 = Q500G6.ReadGpioModel(gpio); log_box.Text += "\r\n" + type.ToString() + " GPIO Output/Input: " + string.Join("", models_q500g6); FormatGpioModel(models_q500g6); break; case TypeEnum.Q600P: char[] models_q600p = Q600P.ReadGpioModel(gpio); log_box.Text += "\r\n" + type.ToString() + " GPIO Output/Input: " + string.Join("", models_q600p); FormatGpioModel(models_q600p); break; default: break; } }
private void Val_btn_Click(object sender, RoutedEventArgs e) { TypeEnum type = (TypeEnum)Enum.Parse(typeof(TypeEnum), combobox_type.SelectedItem.ToString(), false); string[] data = { gpio1_v.Text, gpio2_v.Text, gpio3_v.Text, gpio4_v.Text, gpio5_v.Text, gpio6_v.Text, gpio7_v.Text, gpio8_v.Text }; foreach (string str in data) { if (str.Trim().Length == 0) { MessageBox.Show("不能输入空字符!", "ERROR"); return; } } log_box.AppendText("\r\n"); log_box.AppendText("GPIO Pin polarity Click ================>>>" + string.Join("", data)); gpio.InitSuperIO(); switch (type) { case TypeEnum.Q300P: Q300P.SetGpioValues(gpio, data); LoadGpioModel(TypeEnum.Q300P); LoadGpioValue(TypeEnum.Q300P); gpio.ExitSuperIo(); break; case TypeEnum.Q500G6: Q500G6.SetGpioValues(gpio, data, this); LoadGpioModel(TypeEnum.Q500G6); LoadGpioValue(TypeEnum.Q500G6); gpio.ExitSuperIo(); break; case TypeEnum.Q600P: Q600P.SetGpioValues(gpio, data, this); LoadGpioModel(TypeEnum.Q600P); LoadGpioValue(TypeEnum.Q600P); gpio.ExitSuperIo(); break; default: break; } }