private void filterSelect_rd_checked(object sender, RoutedEventArgs e) { RadioButton rdBtn = sender as RadioButton; if (highFilter_cb == null || midFilter_cb == null || lowFilter_cb == null) { return; } if (rdBtn.Content.ToString() == "高频") { highFilter_cb.Visibility = Visibility.Visible; midFilter_cb.Visibility = Visibility.Hidden; lowFilter_cb.Visibility = Visibility.Hidden; highFilter_cb.SelectedIndex = 0; ProtocolCommands.setFilter(0x01, 1); } else if (rdBtn.Content.ToString() == "中频") { highFilter_cb.Visibility = Visibility.Hidden; midFilter_cb.Visibility = Visibility.Visible; lowFilter_cb.Visibility = Visibility.Hidden; midFilter_cb.SelectedIndex = 0; ProtocolCommands.setFilter(0x02, 1); } else if (rdBtn.Content.ToString() == "低频") { highFilter_cb.Visibility = Visibility.Hidden; midFilter_cb.Visibility = Visibility.Hidden; lowFilter_cb.Visibility = Visibility.Visible; lowFilter_cb.SelectedIndex = 0; ProtocolCommands.setFilter(0x03, 1); } }
private void filter_high_CB_Changed(object sender, SelectionChangedEventArgs e) { ComboBox cb = sender as ComboBox; if (cb.Visibility == Visibility.Visible) { ProtocolCommands.setFilter(0x01, Convert.ToByte(cb.SelectedIndex + 1)); } }
private void gain_mid_CB_Changed(object sender, SelectionChangedEventArgs e) { ComboBox cb = sender as ComboBox; if (cb.Visibility == Visibility.Visible) { ProtocolCommands.setGain(0x02, Convert.ToByte(cb.SelectedIndex + 1)); } }
private void sampleRate_low_CB_Changed(object sender, SelectionChangedEventArgs e) { ComboBox cb = sender as ComboBox; if (cb.Visibility == Visibility.Visible) { ProtocolCommands.setSampleRate(0x03, Convert.ToByte(cb.SelectedIndex + 1)); } }
private void winLength_CB_Changed(object sender, SelectionChangedEventArgs e) { ComboBox winLen_cb = sender as ComboBox; ProtocolCommands.setWindowLength(Convert.ToByte(winLen_cb.SelectedIndex + 1)); }
private void paramConfigCompleteButton_click(object sender, RoutedEventArgs e) { Int32 timelen; byte hour; byte mins; byte secs; try { timelen = Convert.ToInt32(sampleTimeLength_tb.Text); hour = Convert.ToByte(hour_tbox.Text); mins = Convert.ToByte(hour_tbox.Text); secs = Convert.ToByte(hour_tbox.Text); } catch { MessageBox.Show("请输入正确的时长和时间!"); return; } #region Channels Configuration byte[] channelsStatus = new byte[12]; if (ch1_cb.IsChecked == true) { channelsStatus[0] = 0x01; } else { channelsStatus[0] = 0x00; } if (ch2_cb.IsChecked == true) { channelsStatus[1] = 0x01; } else { channelsStatus[1] = 0x00; } if (ch3_cb.IsChecked == true) { channelsStatus[2] = 0x01; } else { channelsStatus[2] = 0x00; } if (ch4_cb.IsChecked == true) { channelsStatus[3] = 0x01; } else { channelsStatus[3] = 0x00; } if (ch5_cb.IsChecked == true) { channelsStatus[4] = 0x01; } else { channelsStatus[4] = 0x00; } if (ch6_cb.IsChecked == true) { channelsStatus[5] = 0x01; } else { channelsStatus[5] = 0x00; } if (ch7_cb.IsChecked == true) { channelsStatus[6] = 0x01; } else { channelsStatus[6] = 0x00; } if (ch8_cb.IsChecked == true) { channelsStatus[7] = 0x01; } else { channelsStatus[7] = 0x00; } if (ch9_cb.IsChecked == true) { channelsStatus[8] = 0x01; } else { channelsStatus[8] = 0x00; } if (ch10_cb.IsChecked == true) { channelsStatus[9] = 0x01; } else { channelsStatus[9] = 0x00; } if (ch11_cb.IsChecked == true) { channelsStatus[10] = 0x01; } else { channelsStatus[10] = 0x00; } if (ch1_cb.IsChecked == true) { channelsStatus[11] = 0x01; } else { channelsStatus[11] = 0x00; } ProtocolCommands.setChannels(channelsStatus); #endregion #region Time Configuration ProtocolCommands.setSampleTime(timelen, hour, mins, secs); #endregion }