领胜LDS 键盘AOI检测项目
wells.liu
2020-07-10 67c0c0d55c193d00ef6f3481e1f081d236bcab13
src/Bro.M071.Process/UI/M071_MainForm.cs
@@ -51,35 +51,37 @@
            if (string.IsNullOrWhiteSpace(Config.BackgroundImagePath))
                return;
            try
            this.Invoke(new Action(() =>
            {
                Bitmap image = (Bitmap)Image.FromFile(Config.BackgroundImagePath);
                cvImage.LoadImage(image);
                cvImage.SetScreenSize();
            }
            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;
            if (txtBarcode.IsHandleCreated)
                txtBarcode.BeginInvoke(new Action(() => 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;