From 67c0c0d55c193d00ef6f3481e1f081d236bcab13 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期五, 10 七月 2020 12:55:32 +0800 Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071 --- src/Bro.M071.Process/UI/M071_MainForm.cs | 80 +++++++++++++++++++++++++++------------ 1 files changed, 55 insertions(+), 25 deletions(-) diff --git a/src/Bro.M071.Process/UI/M071_MainForm.cs b/src/Bro.M071.Process/UI/M071_MainForm.cs index 63f429e..938e116 100644 --- a/src/Bro.M071.Process/UI/M071_MainForm.cs +++ b/src/Bro.M071.Process/UI/M071_MainForm.cs @@ -1,4 +1,5 @@ -锘縰sing Bro.Common.Helper; +锘縰sing Bro.Common.Base; +using Bro.Common.Helper; using Bro.UI.Model.Winform; using System; using System.Collections.Generic; @@ -31,6 +32,13 @@ plImage.Controls.Add(cvImage); tscEditLocation.Visible = tsmiShowEditor.Checked = false; + + this.Load += async (s, e) => + { + await Task.Delay(300); + + cvImage.SetScreenSize(); + }; } public override void OnProcessUpdated() @@ -43,33 +51,37 @@ if (string.IsNullOrWhiteSpace(Config.BackgroundImagePath)) return; - try + this.Invoke(new Action(() => { - Bitmap image = (Bitmap)Image.FromFile(Config.BackgroundImagePath); - cvImage.LoadImage(image); - } - catch (Exception ex) - { - LogAsync(new LogMsg(DateTime.Now, "杞藉叆鑳屾櫙鍥惧紓甯�", ex.Message)); - return; - } - - cvImage.Elements.Clear(); - lvMeasures.Items.Clear(); - Config.MeasurementUnitCollection.ForEach(u => - { - if (!u.IsEnabled) + try + { + Bitmap image = (Bitmap)Image.FromFile(Config.BackgroundImagePath); + cvImage.LoadImage(image); + cvImage.SetScreenSize(); + } + catch (Exception ex) + { + LogAsync(new LogMsg(DateTime.Now, "杞藉叆鑳屾櫙鍥惧紓甯�", ex.Message)); return; + } - var ele = new KeyIndicator(u.Id, u.DisplayLocation); - cvImage.Elements.Add(ele); + cvImage.Elements.Clear(); + lvMeasures.Items.Clear(); + txtBarcode.ReadOnly = Config.IsBarcodeManulInputBlocked; - ListViewItem item = new ListViewItem(u.GetDisplayText()); - item.Tag = u.Id; - lvMeasures.Items.Add(item); - }); + Config.MeasurementUnitCollection.ForEach(u => + { + if (!u.IsEnabled) + return; - txtBarcode.ReadOnly = Config.IsBarcodeManulInputBlocked; + var ele = new KeyIndicator(u.Id, u.DisplayLocation); + cvImage.Elements.Add(ele); + + ListViewItem item = new ListViewItem(u.GetDisplayText()); + item.Tag = u.Id; + lvMeasures.Items.Add(item); + }); + })); Process_M071.OnClearBarcode -= M071_MainForm_OnClearBarcode; Process_M071.OnClearBarcode += M071_MainForm_OnClearBarcode; @@ -149,6 +161,19 @@ MessageBox.Show("鏍囩淇敼瀹屾垚"); } + + private void lvMeasures_DoubleClick(object sender, EventArgs e) + { + if (lvMeasures.SelectedItems.Count <= 0) + return; + + var ele = cvImage.Elements.FirstOrDefault(u => u.ID == lvMeasures.SelectedItems[0].Tag.ToString()); + if (ele != null) + { + ele.State = ElementState.Selected; + cvImage.Invalidate(); + } + } #endregion #region 涓婃柟鐘舵�佸尯 @@ -167,6 +192,11 @@ { txtBarcode.Text = _barcode; _barcode = ""; + } + + if (e.KeyValue == 27) + { + cvImage.Elements.ToList().ForEach(ele => ele.State = ElementState.Normal); } } @@ -307,12 +337,12 @@ } else if (btnStartMeasure.Text == "缁х画娴嬮噺") { - Process_M071.ResumeJob(null, null, null); + Process_M071.SwitchJobStatus(new OperationConfigBase() { InputPara = new List<int>() { 0 } }, null, null); btnStartMeasure.Text = "鏆傚仠娴嬮噺"; } else { - Process_M071.PauseJob(null, null, null); + Process_M071.SwitchJobStatus(new OperationConfigBase() { InputPara = new List<int>() { 1 } }, null, null); btnStartMeasure.Text = "缁х画娴嬮噺"; } -- Gitblit v1.8.0