/// <summary> /// 更新板架孔 /// </summary> /// <param name="rackName">板架名称</param> /// <param name="dataList">孔数据</param> private void updateRackHole(string rackName, TipBoxRackModel currentRackModel) { App.Current.Dispatcher.Invoke((Action)(() => { if ("CurrentTipRack".Equals(rackName)) { TipRackControl rackControl = currentTipRack; if (rackControl.Content is WrapPanel wrap) { updateHole(wrap, currentRackModel.RackDataList, 0); } } else { if (tipSmallRackDict.ContainsKey(rackName)) { TipRackSmallControl rackControl = tipSmallRackDict[rackName]; if (rackControl.Content is WrapPanel wrap) { updateHole(wrap, currentRackModel.RackDataList, 1); } } } })); }
/// <summary> /// 初始化 /// </summary> private void init() { smallRackColor = (Color)ColorConverter.ConvertFromString("#FF1874CD"); bigRackColor = (Color)ColorConverter.ConvertFromString("#FF76EEC6"); holeTrueColor = (Color)ColorConverter.ConvertFromString("#000000"); holeFalseColor = (Color)ColorConverter.ConvertFromString("#FFD6ECFF"); currentTipRack = View.CurrentTipRack; tipSmallRackDict = new Dictionary <string, TipRackSmallControl>(); tipSmallRackDict.Add(View.TipBoxRack1.Name, View.TipBoxRack1); tipSmallRackDict.Add(View.TipBoxRack2.Name, View.TipBoxRack2); tipSmallRackDict.Add(View.TipBoxRack3.Name, View.TipBoxRack3); tipSmallRackDict.Add(View.TipBoxRack4.Name, View.TipBoxRack4); tipSmallRackDict.Add(View.TipBoxRack5.Name, View.TipBoxRack5); tipSmallRackDict.Add(View.TipBoxRack6.Name, View.TipBoxRack6); tipSmallRackDict.Add(View.TipBoxRack7.Name, View.TipBoxRack7); tipSmallRackDict.Add(View.TipBoxRack8.Name, View.TipBoxRack8); tipSmallRackDict.Add(View.TipBoxRack9.Name, View.TipBoxRack9); rectDict = new Dictionary <string, Rectangle>(); rectDict.Add(View.TipBoxRackRect1.Name, View.TipBoxRackRect1); rectDict.Add(View.TipBoxRackRect2.Name, View.TipBoxRackRect2); rectDict.Add(View.TipBoxRackRect3.Name, View.TipBoxRackRect3); rectDict.Add(View.TipBoxRackRect4.Name, View.TipBoxRackRect4); rectDict.Add(View.TipBoxRackRect5.Name, View.TipBoxRackRect5); rectDict.Add(View.TipBoxRackRect6.Name, View.TipBoxRackRect6); rectDict.Add(View.TipBoxRackRect7.Name, View.TipBoxRackRect7); rectDict.Add(View.TipBoxRackRect8.Name, View.TipBoxRackRect8); rectDict.Add(View.TipBoxRackRect9.Name, View.TipBoxRackRect9); //发送[TipBoxRack]获取当前板架名称 TipBoxRackModel currentRackModel = TipBoxRackManager.Instance.Execute(TipBoxRackEventCode.GETCURRENTRACKMODEL, null) as TipBoxRackModel; //当前板架 UpdateCurrentRack(currentRackModel); //小板架 foreach (string rackName in tipSmallRackDict.Keys) { UpdateRack(TipBoxRackManager.Instance.Execute(TipBoxRackEventCode.GETRACKMODEL, rackName) as TipBoxRackModel); } }