From dbae9c048fa0cd67c2e1161e5b6b693f87064154 Mon Sep 17 00:00:00 2001
From: wells.liu <wells.liu@broconcentric.com>
Date: 星期三, 01 七月 2020 17:53:15 +0800
Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071

---
 src/Bro.M071.Process/M071Models.cs |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/Bro.M071.Process/M071Models.cs b/src/Bro.M071.Process/M071Models.cs
index be596b7..d9a40ac 100644
--- a/src/Bro.M071.Process/M071Models.cs
+++ b/src/Bro.M071.Process/M071Models.cs
@@ -3,6 +3,7 @@
 using Bro.Common.Helper;
 using Bro.Common.Interface;
 using Bro.Common.Model;
+using HalconDotNet;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
@@ -11,6 +12,7 @@
 using System.Drawing.Design;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 
 namespace Bro.M071.Process
@@ -195,18 +197,20 @@
 
     public class ProductionMeasurement : INotifyPropertyChanged, IDisposable
     {
-        public string Barcode { get; set; }
+        public string Barcode;
 
-        public List<MeasurementUint> Measurements { get; set; } = new List<MeasurementUint>();
+        public List<MeasurementUint> Measurements = new List<MeasurementUint>();
+
+        public List<IShapeElement> ElementList = new List<IShapeElement>();
 
         public event PropertyChangedEventHandler PropertyChanged;
 
         public void Dispose()
         {
-            Barcode = null;
-
             Measurements?.ForEach(m => m?.Dispose());
             Measurements = null;
+
+            Barcode = null;
             GC.Collect();
         }
 
@@ -304,6 +308,10 @@
         [TypeConverter(typeof(KeyUnitResultConverter))]
         public string KeyResult { get; set; } = "";
 
+
+        public List<HImage> KeyImages = new List<HImage>();
+
+        public volatile int ImageSaveStatus = 0;
         //[Browsable(false)]
         //public NoticedDictionary<string, double?> MeasureValueDict { get; set; } = new NoticedDictionary<string, double?>();
 
@@ -335,6 +343,18 @@
 
         public void Dispose()
         {
+            SpinWait wait = new SpinWait();
+            while (ImageSaveStatus != 0)
+            {
+                wait.SpinOnce();
+            }
+
+            KeyImages?.ForEach(i =>
+            {
+                i?.Dispose();
+                i = null;
+            });
+            KeyImages = null;
             MeasureValueDict = null;
         }
 

--
Gitblit v1.8.0