/// <summary>
        /// 根据发布的信息更新终端树状态信息
        /// </summary>
        /// <param name="basicTmlInfomation"></param>
        private void UpdateTerminalInfo(Wlst.Sr.EquipmentInfoHolding.Model.WjParaBase basicTmlInfomation)
        {
            NodeName = basicTmlInfomation.RtuName;
            this.Md5 = basicTmlInfomation.DateUpdate;


            var tmps = basicTmlInfomation as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu;

            if (tmps != null && tmps.WjGprs != null)
            {
                PhoneNumber = tmps.WjGprs.MobileNo;
            }
        }
        public TreeNodeItemTmlViewModel(TreeNodeBaseNode mvvmFather, Wlst.Sr.EquipmentInfoHolding.Model.WjParaBase terminalInfomation)
        {
            this.NodeType = TypeOfTabTreeNode.IsTml;
            Visi          = Visibility.Visible;
            this._father  = mvvmFather;
            Md5           = 0;

            //TreeSingleViewModel.RegisterNodeToControl(this);

            if (terminalInfomation == null)
            {
                this.NodeName = "加载出错";
            }
            else
            {
                modelx        = (int )terminalInfomation.RtuModel;
                this.NodeName = terminalInfomation.RtuName;
                // this.ImagesIcon = ImageResources.GetEquipmentIcon(1010198);
                this.NodeId = terminalInfomation.RtuId;
                Md5         = terminalInfomation.DateUpdate;
                UpdateTmlStateInfomation();
                PhyId = terminalInfomation.RtuPhyId;


                var tmps = terminalInfomation as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu;
                if (tmps != null && tmps.WjGprs != null)
                {
                    PhoneNumber = tmps.WjGprs.MobileNo;
                }
            }

            if (!BaseNodes.Nodess.ContainsKey((NodeId)))
            {
                BaseNodes.AddNode(this);
            }
            else
            {
                //Wlst.Cr.CoreMims.ShowMsgInfo.ShowNewMsg.AddNewShowMsg(NodeId, "0000", OperatrType.SystemInfo, "Error");
            }
        }
        //  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");
            }
        }