Exemple #1
0
        //private int _rtuModes=0;
        public TreeNodeItemAttachEquViewModel(TreeNodeBaseNode mvvmFather,
                                              Wlst.Sr.EquipmentInfoHolding.Model.WjParaBase attachInfomation)
        {
            AttInfo       = attachInfomation;
            this.NodeType = TypeOfTabTreeNode.IsTmlParts;
            //Visi = Visibility.Visible;
            this._father = mvvmFather;

            if (attachInfomation == null)
            {
                this.NodeName = "加载出错";
            }
            else
            {
                this.NodeName = attachInfomation.RtuName;
                var running = Wlst.Sr.EquipmentInfoHolding.Services.RunningInfoHold.GetRunInfo(attachInfomation.RtuId);
                //if (running != null && running.ErrorCount > 0)
                //{
                //this.ImagesIcon = ImageResources.GetEquipmentIcon((int) attachInfomation.RtuModel + 1);
                //}
                //else
                //{
                this.ImagesIcon = ImageResources.GetEquipmentIcon((int)attachInfomation.RtuModel);
                //}

                this.NodeId = attachInfomation.RtuId;
                this.Md5    = attachInfomation.DateUpdate;
                RtuModel    = (int)attachInfomation.RtuModel;
            }
        }
Exemple #2
0
 public static void AddNode(TreeNodeBaseNode node)
 {
     if (!Nodess.ContainsKey(node.NodeId))
     {
         Nodess.Add(node.NodeId, new List <TreeNodeBaseNode>());
     }
     Nodess[node.NodeId].Add(node);
 }
Exemple #3
0
        //  protected Wlst.Sr.EquipmentInfoHolding.Model.WjParaBase TerInfo;
        public TreeNodeItemTmlViewModel(TreeNodeBaseNode mvvmFather, Wlst.Sr.EquipmentInfoHolding.Model.WjParaBase terminalInfomation, bool newInArea = false)
        {
            this.NodeType = TypeOfTabTreeNode.IsTml;
            //Visi = Visibility.Visible;
            this._father = mvvmFather;
            Md5          = 0;
            //TerInfo = terminalInfomation;

            if (terminalInfomation != null)
            {
                WeakReference refs = new WeakReference(this);
                if (RtuItems.ContainsKey(terminalInfomation.RtuId) == false)
                {
                    RtuItems.Add(terminalInfomation.RtuId, new List <WeakReference>());
                }
                RtuItems[terminalInfomation.RtuId].Add(refs);
            }

            //TreeSingleViewModel.RegisterNodeToControl(this);

            if (terminalInfomation == null)
            {
                this.NodeName = "加载出错";
            }
            else
            {
                if (newInArea)
                {
                    this.NodeName = "*_" + terminalInfomation.RtuName;
                }
                else
                {
                    this.NodeName = terminalInfomation.RtuName;
                }
                // this.ImagesIcon = ImageResources.GetEquipmentIcon(1010198);
                this.NodeId  = terminalInfomation.RtuId;
                this.RtuOnly = terminalInfomation.Idf;
                //this.RtuOnlyCode = terminalInfomation.Idf;
                Md5 = terminalInfomation.DateUpdate;
                UpdateTmlStateInfomation();
                PhyId          = terminalInfomation.RtuPhyId;
                TmlState       = PicIndex;
                RtuInstallAddr = terminalInfomation.RtuInstallAddr;
                var paras = terminalInfomation as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu;

                if (paras != null && paras.WjGprs != null)
                {
                    PhoneNumber = paras.WjGprs.MobileNo;
                    IpAddr      = new System.Net.IPAddress(BitConverter.GetBytes(paras.WjGprs.StaticIp)).ToString();
                }
                #region Attach
                //var attachToRtu = terminalInfomation.EquipmentsThatAttachToThisRtu;
                //if(attachToRtu ==null) return;
                //foreach(var f in attachToRtu)
                //{
                //    var nodeInfo = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                //    string nodeName = nodeInfo.RtuName;

                //    if (f < 1199999)
                //        this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0,
                //                                                                     TypeOfTabTreeNode.IsTmlParts) { NodeId = f, NodeName = nodeName + "-防盗", ImagesIcon = ImageResources.LduIcon });
                //    else if (f < 1299999)
                //        this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0,
                //                                                                     TypeOfTabTreeNode.IsTmlParts)
                //                                    {
                //                                        NodeId = f,
                //                                        NodeName = nodeName + "- 节电",
                //                                        ImagesIcon = ImageResources.EsuIcon
                //                                    });
                //    else if(f<1399999)
                //        this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0,
                //                                                                         TypeOfTabTreeNode.IsTmlParts)
                //        {
                //            NodeId = f,
                //            NodeName = nodeName + "- 电表",
                //            ImagesIcon = ImageResources.MruIcon
                //        });
                //    else if (f < 1499999)
                //        this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0,
                //                                                                         TypeOfTabTreeNode.IsTmlParts)
                //        {
                //            NodeId = f,
                //            NodeName = nodeName + "- 光控",
                //            ImagesIcon = ImageResources.LuxIcon
                //        });
                //    else if (f < 1599999)
                //        this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0,
                //                                                                         TypeOfTabTreeNode.IsTmlParts)
                //        {
                //            NodeId = f,
                //            NodeName = nodeName + "- 单灯",
                //            ImagesIcon = ImageResources.SluIcon
                //        });
                //}
                #endregion
            }

            if (!BaseNodes.Nodess.ContainsKey((NodeId)))
            {
                BaseNodes.AddNode(this);
            }
            else
            {
                //Wlst.Cr.CoreMims.ShowMsgInfo.ShowNewMsg.AddNewShowMsg(NodeId, "0000", OperatrType.SystemInfo, "Error");
            }
        }