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 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(); } }