private void OK_Click(object sender, RoutedEventArgs e) { if (comboBox_DevIndex.SelectedIndex == -1 || comboBox_DevChannel.SelectedIndex == -1) { DXMessageBox.Show((string)Application.Current.Resources["tePromptText1"], (string)FindResource("tePrompt"), MessageBoxButton.OK, MessageBoxImage.Warning); } else { IsSelected = true; _conn.DevType = m_arrdevtype[_conn.TypeIndex]; _conn.ConnObject = comboBox_DevType.SelectedItem.ToString(); _conn.RunDevice(); //保存上次打开的CAN盒类型 CANTest.Properties.Settings.Default.TypeIndex = _conn.TypeIndex; CANTest.Properties.Settings.Default.Save(); //保存设置 this.Close(); } }
private void OperateDevice_Executed(object sender, ExecutedRoutedEventArgs e) { ZLGEntity _conn = (ZLGEntity)TabGroup.SelectedItem; if (e.Parameter.ToString() == "Start") { _conn.RunDevice(); if (!_conn.Flag) { DXMessageBox.Show((string)Application.Current.Resources["tePromptText2"], (string)Application.Current.Resources["tePrompt"], MessageBoxButton.OK, MessageBoxImage.Warning); } } else if (e.Parameter.ToString() == "Close") { _conn.StopDevice(); tabSource.Remove(_conn); } else { _conn.StopDevice(); } }