private void MainWindow_Closed(object sender, EventArgs e) { foreach (var item in TabGroup.Items) { ZLGEntity _conn = (ZLGEntity)item; _conn.StopDevice(); } }
/* 皮肤选择 * private void biSkinChoose_EditValueChanged(object sender, RoutedEventArgs e) * { * if (biSkinChoose.EditValue == null) * { * return; * } * ThemeManager.ApplicationThemeName = biSkinChoose.EditValue.ToString();// biSkinChoose.EditValue.ToString(); * this.UpdateLayout(); * } */ private void TabGroup_TabHiding(object sender, TabControlTabHidingEventArgs e) { ZLGEntity _conn = (ZLGEntity)TabGroup.SelectedItem; _conn.StopDevice(); tabSource.Remove(_conn); //回收垃圾 GC.Collect(); GC.WaitForPendingFinalizers(); }
private void ChooseDevice_Executed(object sender, ExecutedRoutedEventArgs e) { ZLGEntity _conn = new ZLGEntity(); SelectCAN _selectCAN = new SelectCAN(_conn); _selectCAN.ShowDialog(); if (_selectCAN.IsSelected) { tabSource.Add(_conn); TabGroup.SelectedItem = _conn; if (!_conn.Flag) { DXMessageBox.Show((string)Application.Current.Resources["tePromptText2"], (string)Application.Current.Resources["tePrompt"], MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void DealData_Executed(object sender, ExecutedRoutedEventArgs e) { ZLGEntity _conn = (ZLGEntity)TabGroup.SelectedItem; if (e.Parameter.ToString() == "send") { _conn.StartThread(); } else if (e.Parameter.ToString() == "clear") { _conn.dealDataTable(_conn.CANData.NewRow(), "clear"); } else if (e.Parameter.ToString() == "stop") { _conn.AbortThread(); } else if (e.Parameter.ToString() == "export") { _conn.dealDataTable(_conn.CANData.NewRow(), "export"); } }
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(); } }
public SelectCAN(ZLGEntity conn) { _conn = conn; InitializeComponent(); selectGrid.DataContext = _conn; }