/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnScan_Click(object sender, RoutedEventArgs e) { ScanWindow scan = new ScanWindow { }; //如果是激活状态则返回 if (scan.IsClosed) { scan.Close(); } else { if (scan.ShowDialog() == false) { switch ((sender as TextBox).Name) { case "txtOrderNum": break; case "txtSampleId": break; } } } }
/// <summary> /// 点击扫描按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnScan_Click(object sender, RoutedEventArgs e) { ScanWindow scan = new ScanWindow { Owner = App.CurrentWindow }; //如果是激活状态则返回 if (scan.IsClosed) { return; } if (scan.ShowDialog() == false) { TextBox txtBox = (sender as TextBox); txtBox.Text = scan.BarCode; } }