| | |
| | | M071Config Config => Process?.IConfig as M071Config; |
| | | M071Process Process_M071 => Process as M071Process; |
| | | |
| | | System.Threading.Timer _refreshUITimer = null; |
| | | |
| | | |
| | | public M071_MainForm() |
| | | { |
| | | InitializeComponent(); |
| | |
| | | |
| | | tscEditLocation.Visible = tsmiShowEditor.Checked = false; |
| | | |
| | | _refreshUITimer = new System.Threading.Timer(OnRefreshUI, null, -1, -1); |
| | | this.Load += async (s, e) => |
| | | { |
| | | await Task.Delay(300); |
| | |
| | | cvImage.OnElementChangedHandle -= CvImage_OnElementChangedHandle; |
| | | cvImage.OnElementChangedHandle += CvImage_OnElementChangedHandle; |
| | | |
| | | timer1.Enabled = true; |
| | | //timer1.Enabled = true; |
| | | |
| | | btnReset.Text = $"复位(长按{Config.FullResetRequiredDuration}秒大复位)"; |
| | | |
| | |
| | | Process_M071.OnFullResetDone -= Process_M071_FullResetDone; |
| | | Process_M071.OnFullResetDone += Process_M071_FullResetDone; |
| | | |
| | | Process_M071.OnResetDone -= Process_M071_ResetDone; |
| | | Process_M071.OnResetDone += Process_M071_ResetDone; |
| | | |
| | | Config.PropertyChanged -= Config_PropertyChanged; |
| | | Config.PropertyChanged += Config_PropertyChanged; |
| | | |
| | |
| | | |
| | | Process_M071.OnCheckHintUpload = OnCheckHintUpload; |
| | | Process_M071.OnOperatorLogin = OnOperatorLogin; |
| | | } |
| | | |
| | | private void Process_M071_ResetDone() |
| | | { |
| | | lblCT.BeginInvoke(new Action(() => |
| | | { |
| | | lblCT.Text = ""; |
| | | })); |
| | | } |
| | | |
| | | private void Config_PropertyChanged(object sender, PropertyChangedEventArgs e) |
| | |
| | | #endregion |
| | | |
| | | #region 标签结果显示 |
| | | |
| | | private void OnRefreshUI(object state) |
| | | { |
| | | cvImage.Invoke(new Action(() => Refresh())); |
| | | } |
| | | |
| | | private async void Process_M071_OnElementUpdated(Common.Interface.IShapeElement obj) |
| | | { |
| | | //this.Invoke(new Action(() => |
| | |
| | | (ele as KeyIndicator).Text = keyIndicator.Text; |
| | | (ele as KeyIndicator).ResultState = keyIndicator.ResultState; |
| | | |
| | | this.Invalidate(); |
| | | //this.Invalidate(); |
| | | _refreshUITimer.Change(1000, -1); |
| | | })); |
| | | } |
| | | |
| | |
| | | |
| | | private void timer1_Tick(object sender, EventArgs e) |
| | | { |
| | | cvImage.Refresh(); |
| | | //cvImage.Refresh(); |
| | | } |
| | | |
| | | private void lblOperator_DoubleClick(object sender, EventArgs e) |
| | |
| | | })); |
| | | }); |
| | | } |
| | | |
| | | bool isStart = true; |
| | | private void button1_Click(object sender, EventArgs e) |
| | | { |
| | | Task.Run(async () => |
| | | { |
| | | try |
| | | { |
| | | for (int j = 0; j < 10000; j++) |
| | | { |
| | | int i = 0; |
| | | |
| | | if (isStart) |
| | | { |
| | | cvImage.Elements.ToList().ForEach(ele => |
| | | { |
| | | if (ele is KeyIndicator indicator) |
| | | { |
| | | indicator.Text = ""; |
| | | indicator.ResultState = null; |
| | | } |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | cvImage.Elements.ToList().ForEach(ele => |
| | | { |
| | | if (ele is KeyIndicator indicator) |
| | | { |
| | | indicator.Text = (i++).ToString(); |
| | | indicator.ResultState = true; |
| | | } |
| | | }); |
| | | } |
| | | isStart = !isStart; |
| | | cvImage.BeginInvoke(new Action(() => Refresh())); |
| | | LogAsync(DateTime.Now, $"UI Refresh {j}", ""); |
| | | await Task.Delay(300); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | |
| | | }); |
| | | } |
| | | } |
| | | } |