| | |
| | | timer.Elapsed += Timer_Elapsed; |
| | | InitializeComponent(); |
| | | |
| | | if (testResultView.executionWrapper is TsExecutionWrapper tsWrapper) |
| | | { |
| | | tsWrapper.AxApplicationMgr.ExitApplication += new EventHandler(this.axApplicationMgr_ExitApplication); |
| | | tsWrapper.AxApplicationMgr.UIMessageEvent += new _ApplicationMgrEvents_UIMessageEventEventHandler(this.axApplicationMgr_UIMessageEvent); |
| | | tsWrapper.AxApplicationMgr.ExecutionClosed += new _ApplicationMgrEvents_ExecutionClosedEventHandler(this.axApplicationMgr_ExecutionClosed); |
| | | } |
| | | |
| | | |
| | | //testResultView.testApp.ExitApplication += new EventHandler(this.axApplicationMgr_ExitApplication); |
| | | //testResultView.testApp.UIMessageEvent += new _ApplicationMgrEvents_UIMessageEventEventHandler(this.axApplicationMgr_UIMessageEvent); |
| | | //testResultView.testApp.ExecutionClosed += new _ApplicationMgrEvents_ExecutionClosedEventHandler(this.axApplicationMgr_ExecutionClosed); |
| | | } |
| | | |
| | | private void HandleUIMessage(int EventCase, int MethodCode, string strData, object xData) |
| | | { |
| | | try |
| | | { |
| | | try |
| | | { |
| | | log.Debug($"EventCase: {EventCase}, MethodCode: {MethodCode}, StrData: {strData}"); |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | |
| | | if (EventCase == 8) |
| | | { |
| | | IsRunning = false; |
| | | return; |
| | | } |
| | | |
| | | if (EventCase != 10014) return; |
| | | |
| | | if (MethodCode == 0) |
| | | { |
| | | /// 设置句柄 |
| | | this.SequenceContext = (SequenceContext)xData; |
| | | return; |
| | | } |
| | | |
| | | |
| | | if (MethodCode == 8) |
| | | { |
| | | /// 更新MES状态 |
| | | mesStatus = strData == "1"; |
| | | return; |
| | | } |
| | | |
| | | if (MethodCode == 9) |
| | | { |
| | | /// 更新生产状态 |
| | | produceStatus = strData; |
| | | return; |
| | | } |
| | | } |
| | | catch |
| | | { } |
| | | } |
| | | |
| | | private void ExecutionWrapper_UIMessageEvent(object sender, UIMessageEvent e) |
| | | { |
| | | HandleUIMessage(e.EventCode, Convert.ToInt16(e.NumberData), e.StrData, e.Data); |
| | | } |
| | | |
| | | private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) |
| | |
| | | string path = Path.Combine(BaseFolder, "Count.ini"); |
| | | testResultView.SetCountIniPath(path); |
| | | testResultView.InitMainGrid(); |
| | | testResultView.InitTestStandEngine(); |
| | | |
| | | path = Path.Combine(BaseFolder, "Scanner.ini"); |
| | | if (!File.Exists(path)) |
| | |
| | | testResultView.testSeqFile = string.Empty; |
| | | FileName = string.Empty; |
| | | } |
| | | string type = Path.GetExtension(FileName); |
| | | bool isTap = string.Equals(".tapplan", type, StringComparison.OrdinalIgnoreCase); |
| | | |
| | | testResultView.InitTestStandEngine(isTap); |
| | | testResultView.executionWrapper.UIMessageEvent += ExecutionWrapper_UIMessageEvent; |
| | | |
| | | RefreshUIConfig(); |
| | | } |
| | | |
| | |
| | | { |
| | | log.Error("RefreshUIConfig Error.", ex); |
| | | } |
| | | } |
| | | |
| | | private void axApplicationMgr_ExitApplication(object sender, EventArgs e) |
| | | { |
| | | } |
| | | |
| | | private void axApplicationMgr_ExecutionClosed(object sender, _ApplicationMgrEvents_ExecutionClosedEvent e) |
| | | { |
| | | } |
| | | |
| | | private void axApplicationMgr_UIMessageEvent(object sender, _ApplicationMgrEvents_UIMessageEventEvent e) |
| | | { |
| | | try |
| | | { |
| | | int EventCase = Convert.ToInt32(e.uiMsg.Event); |
| | | int MethodCode = Convert.ToInt16(e.uiMsg.NumericData); |
| | | string strData; |
| | | |
| | | try |
| | | { |
| | | log.Debug($"EventCase: {EventCase}, MethodCode: {MethodCode}, StrData: {e.uiMsg.StringData}"); |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | |
| | | if (EventCase == 8) |
| | | { |
| | | IsRunning = false; |
| | | return; |
| | | } |
| | | |
| | | if (EventCase != 10014) return; |
| | | |
| | | if (MethodCode == 0) |
| | | { |
| | | /// 设置句柄 |
| | | this.SequenceContext = (SequenceContext)e.uiMsg.ActiveXData; |
| | | return; |
| | | } |
| | | |
| | | |
| | | if (MethodCode == 8) |
| | | { |
| | | /// 更新MES状态 |
| | | strData = e.uiMsg.StringData; |
| | | mesStatus = strData == "1"; |
| | | return; |
| | | } |
| | | |
| | | if (MethodCode == 9) |
| | | { |
| | | /// 更新生产状态 |
| | | strData = e.uiMsg.StringData; |
| | | produceStatus = strData; |
| | | return; |
| | | } |
| | | } |
| | | catch |
| | | { } |
| | | } |
| | | |
| | | private bool isLoaded; |