领胜LDS 键盘AOI检测项目
xcd
2020-07-01 9d05b4e5a7b667afb6d13cbcb460e377c175c170
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;
        }