| | |
| | | using log4net; |
| | | using NationalInstruments.TestStand.Interop.API; |
| | | using NationalInstruments.TestStand.Interop.UI.Ax; |
| | | using Plugin.TestResult; |
| | | using Plugin.TestResult_WPF.Model; |
| | | using Plugin.TestResult_WPF.Util; |
| | | using System; |
| | |
| | | /// <summary> |
| | | /// ViewControl.xaml 的交互逻辑 |
| | | /// </summary> |
| | | public partial class ViewControl : PluginControl |
| | | public partial class ViewControl : PluginMaskControl |
| | | { |
| | | private CommonCodeParser codeParser = new CommonCodeParser(); |
| | | private double TestTemperature = 60; |
| | |
| | | Logger = logger; |
| | | } |
| | | |
| | | private bool isRunning = false; |
| | | public bool IsRunning |
| | | { |
| | | get => isRunning; |
| | | set |
| | | { |
| | | Set(ref isRunning, value); |
| | | testResultView.IsRunning = value; |
| | | this.modelSelect.IsEnabled = !value; |
| | | this.btnStart.IsEnabled = !value; |
| | | this.btnStop.IsEnabled = value; |
| | | } |
| | | } |
| | | |
| | | public ViewControl() |
| | | { |
| | | DataContext = this; |
| | |
| | | |
| | | public override void DoClose(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | testResultView.ReleaseResource(); |
| | | } |
| | | catch |
| | | { |
| | | } |
| | | } |
| | | |
| | | private void axApplicationMgr_ExitApplication(object sender, EventArgs e) |
| | |
| | | string strData; |
| | | |
| | | if (EventCase != 10014) return; |
| | | |
| | | try |
| | | { |
| | | log.Info($"EventCase: {EventCase}, MethodCode: {MethodCode}, StrData: {e.uiMsg.StringData}"); |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | |
| | | if (MethodCode == 0) |
| | | { |
| | |
| | | private bool isLoaded; |
| | | private void UserControl_Loaded(object sender, RoutedEventArgs e) |
| | | { |
| | | new MaskWindow(Window.GetWindow(this), |
| | | (win) => |
| | | { |
| | | Dispatcher.Invoke(() => |
| | | new MaskWindow(Window.GetWindow(this), (win) => |
| | | { |
| | | try |
| | | { |
| | | Dispatcher.BeginInvoke(new Action(() => |
| | | { |
| | | Start_Click(null, null); |
| | | Loaded -= UserControl_Loaded; |
| | | })); |
| | | } |
| | | finally |
| | | { |
| | | Dispatcher.Invoke(() => |
| | | { |
| | | win.Close(); |
| | | } |
| | | }); |
| | | }).Info(LangUtil.Get("Ts.SequenceIsStarting")); |
| | | } |
| | | }).Info(LangUtil.Get("Ts.SequenceIsStarting"), 100); |
| | | |
| | | //ShowMask(() => |
| | | //{ |
| | | // Dispatcher.BeginInvoke(new Action(() => |
| | | // { |
| | | // System.Threading.Thread.Sleep(100); |
| | | // Start_Click(null, null); |
| | | // Loaded -= UserControl_Loaded; |
| | | // })); |
| | | //}, (ex) => |
| | | //{ |
| | | // log.Error("Loaded Error.", ex); |
| | | // Dispatcher.BeginInvoke(new Action(() => |
| | | // { |
| | | // MsgBoxHelper.Error(Window.GetWindow(this), ex.Message); |
| | | // })); |
| | | //}, "请稍后", LangUtil.Get("Ts.SequenceIsStarting")); |
| | | } |
| | | |
| | | public void LoadProduct() |
| | |
| | | try |
| | | { |
| | | testResultView.StartTestSequence(); |
| | | this.modelSelect.IsEnabled = false; |
| | | this.btnStart.IsEnabled = false; |
| | | this.btnStop.IsEnabled = true; |
| | | IsRunning = true; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | try |
| | | { |
| | | testResultView.StopTest(); |
| | | this.modelSelect.IsEnabled = true; |
| | | this.btnStart.IsEnabled = true; |
| | | this.btnStop.IsEnabled = false; |
| | | IsRunning = false; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | private void ScannerSetting_Click(object sender, RoutedEventArgs e) |
| | | { |
| | | Plugin.TestResult.ScannerSetting setting = new Plugin.TestResult.ScannerSetting() { |
| | | Plugin.TestResult.ScannerSetting setting = new Plugin.TestResult.ScannerSetting() |
| | | { |
| | | Owner = Window.GetWindow(this) |
| | | }; |
| | | setting.Open(false,"Config"); |