| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 | 
							- using OpenSEMI.ClientBase;
 
- using OpenSEMI.Core.Msg;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using System.Windows.Threading;
 
- namespace Venus_MainPages.Unity
 
- {
 
-     public class WaferStatusHandler : IHandler
 
-     {
 
-         public static readonly List<string> ReverseModules = new List<string>() { "LLA","LLB", "LP1", "LP2", "LP3" };
 
-         public WaferStatusHandler(Func<string, List<WaferInfo>> funcGetWaferStatus, List<string> allModules)
 
-         {
 
-             this.WaferStatusDic = new Dictionary<string, ModuleWaferManager>();
 
-             this.looper = new MsgPool(500, Do);
 
-             this.GetWaferStatusByModule = funcGetWaferStatus;
 
-             //init wafer status dictionary
 
-             allModules.ForEach(key => { InitWafersByModule(key); });
 
-         }
 
-         public void Handle()
 
-         {
 
-             this.looper.Run();
 
-         }
 
-         private void InitWafersByModule(string moduleID)
 
-         {
 
-             lock (lockObj)
 
-             {
 
-                 if (!this.WaferStatusDic.ContainsKey(moduleID))
 
-                 {
 
-                     this.WaferStatusDic.Add(moduleID, new ModuleWaferManager(moduleID));
 
-                     List<WaferInfo> mWafers = GetWaferStatusByModule(moduleID);
 
-                     if (mWafers != null)
 
-                     {
 
-                         ModuleWaferManager modinfowithwafer = this.WaferStatusDic[moduleID];
 
-                         for (int i = 0; i < mWafers.Count; i++)
 
-                         {
 
-                             modinfowithwafer.Wafers.Add(mWafers[i]);
 
-                         }
 
-                         if (ReverseModules.Contains(moduleID))
 
-                         {
 
-                             modinfowithwafer.Wafers.Reverse();
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         private void Do(MsgPool pool)
 
-         {
 
-             lock (lockObj)
 
-             {
 
-                 if (Application.Current == null || Application.Current.Dispatcher == null)
 
-                     return;
 
-                 foreach (KeyValuePair<string, ModuleWaferManager> pair in WaferStatusDic)
 
-                 {
 
-                     List<WaferInfo> mWafers = GetWaferStatusByModule(pair.Key);
 
-                     Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)delegate
 
-                     {
 
-                         if (mWafers != null && mWafers.Count == pair.Value.Wafers.Count)
 
-                         {
 
-                             int index;
 
-                             for (int i = 0; i < mWafers.Count; i++)
 
-                             {
 
-                                 //status used in UI control
 
-                                 if (ReverseModules.Contains(pair.Key))
 
-                                     index = mWafers.Count - i - 1;
 
-                                 else
 
-                                     index = i;
 
-                                 pair.Value.Wafers[i].WaferStatus = mWafers[index].WaferStatus;
 
-                                 pair.Value.Wafers[i].WaferID = mWafers[index].WaferID;
 
-                                 pair.Value.Wafers[i].SourceName = mWafers[index].SourceName;
 
-                             }
 
-                         }
 
-                     });
 
-                 }
 
-             }
 
-         }
 
-         public Dictionary<string, ModuleWaferManager> WaferStatusDic { get; private set; }
 
-         public MsgPool looper { get; private set; }
 
-         private Func<string, List<WaferInfo>> GetWaferStatusByModule;
 
-         private static object lockObj = new object();
 
-     }
 
- }
 
 
  |