| | |
| | | { |
| | | Measurements?.ForEach(m => m?.Dispose()); |
| | | Measurements = null; |
| | | |
| | | ElementList = null; |
| | | Barcode = null; |
| | | GC.Collect(); |
| | | } |
| | |
| | | { |
| | | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("KeyUnitCollection")); |
| | | } |
| | | |
| | | public MeasurementUnit Copy() |
| | | { |
| | | MeasurementUnit mUnit = new MeasurementUnit(); |
| | | |
| | | mUnit.Id = this.Id; |
| | | mUnit.Name = this.Name; |
| | | mUnit.IsEnabled = this.IsEnabled; |
| | | mUnit.MeasureType = this.MeasureType; |
| | | |
| | | mUnit.DisplayLocation = new Rectangle(this.DisplayLocation.Location, this.DisplayLocation.Size); |
| | | |
| | | if (this.Spec == null) |
| | | { |
| | | mUnit.Spec = null; |
| | | } |
| | | else |
| | | { |
| | | mUnit.Spec = new MeasureType(); |
| | | mUnit.Spec.Code = this.Spec.Code; |
| | | mUnit.Spec.AlgorithemPath = this.Spec.AlgorithemPath; |
| | | mUnit.Spec.StandardValue = this.Spec.StandardValue; |
| | | mUnit.Spec.Tolrenance_Positive = this.Spec.Tolrenance_Positive; |
| | | mUnit.Spec.Tolrenance_Negative = this.Spec.Tolrenance_Negative; |
| | | } |
| | | |
| | | this.KeyUnitCollection.ForEach(k => |
| | | { |
| | | mUnit.KeyUnitCollection.Add(k.Copy()); |
| | | }); |
| | | |
| | | return mUnit; |
| | | } |
| | | } |
| | | |
| | | public class KeyUnitBind : IComplexDisplay, INotifyPropertyChanged, IDisposable |
| | |
| | | |
| | | public void Dispose() |
| | | { |
| | | SpinWait wait = new SpinWait(); |
| | | while (ImageSaveStatus != 0) |
| | | { |
| | | wait.SpinOnce(); |
| | | Thread.Sleep(10); |
| | | } |
| | | |
| | | KeyImages?.ForEach(i => |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public KeyUnitBind Copy() |
| | | { |
| | | KeyUnitBind clone = new KeyUnitBind(); |
| | | clone.Key = this.Key; |
| | | clone.KeyResultId = this.KeyResultId; |
| | | |
| | | this.MeasureValueDict.Keys.ToList().ForEach(k => |
| | | { |
| | | clone.MeasureValueDict[k] = null; |
| | | }); |
| | | |
| | | return clone; |
| | | } |
| | | } |
| | | |
| | | //public class NoticedDictionary<T1, T2> : Dictionary<T1, T2>, INotifyPropertyChanged |