//public TreeNodeItemSingleGroupViewModel() //{ // this.NodeType = TypeOfTabTreeNode.IsGrp; // //Visi = Visibility.Visible; //} public TreeNodeItemSingleGroupViewModel(TreeNodeBaseNode mvvmFather, int areaId, int groupId, TypeOfTabTreeNode type) { this.AreaId = areaId; this.NodeType = type; this.IsChecked = false; this.IsShowChkTree = Visibility.Collapsed; //Visi = Visibility.Visible; this._father = mvvmFather; //TreeSingleViewModel.RegisterNodeToControl(this); this.NodeColor = "Black"; var nodename = "--"; if (type == TypeOfTabTreeNode.IsGrpSpecial) { nodename = "特殊终端"; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = 0; this.IsShowChkTree = Cr.CoreOne.Services.OptionXmlSvr.GetOptionBool(4001, 2, false) ? Visibility.Visible : Visibility.Collapsed; } if (type == TypeOfTabTreeNode.IsAll) { nodename = "全部终端"; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = 0; } if (type == TypeOfTabTreeNode.IsArea) { this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = areaId; var areaInfo = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef; foreach (var f in areaInfo.AreaInfo) { if (f.Value.AreaId == areaId) { nodename = f.Value.AreaName; } } } if (type == TypeOfTabTreeNode.IsGrp) { var info = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId, groupId); if (info != null) { nodename = info.GroupName; } this.IsShowChkTree = Cr.CoreOne.Services.OptionXmlSvr.GetOptionBool(4001, 2, false) ? Visibility.Visible : Visibility.Collapsed; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = groupId; } this.NodeName = nodename; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.AddChild(); }
/// <summary> /// 当选择的终端发送变化时,如果 /// </summary> public override void OnNodeSelectActive() { if (NodeType != TypeOfTabTreeNode.IsGrp && NodeType != TypeOfTabTreeNode.IsAll) { return; } if (NodeType == TypeOfTabTreeNode.IsGrp) { var info = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId, NodeId); if (info == null) { return; } } //base.OnNodeSelect(); //发布事件 选中当前节点 var args = new PublishEventArgs { EventType = PublishEventType.Core, EventId = Sr.EquipmentInfoHolding.Services.EventIdAssign.GroupSelected, }; args.AddParams(new Wlst.Sr.EquipmentInfoHolding.Model.SelectedInfo(AreaId, NodeId, SelectedInfo.SelectType.SingleGrp)); EventPublish.PublishEvent(args); // base.OnNodeSelectActive(); TreeNodeItemSingleGroupViewModel.CurrentSelectGroupNode = this; // ResetContextMenu(); }
public TreeNodeItemMultiGroupViewModelNew(TreeNodeBaseNode mvvmFather, int areaId, int groupId, TypeOfTabTreeNode type) { this.AreaId = areaId; this.NodeType = type; this._father = mvvmFather; string nodename = "--"; // NodeName = "--"; if (type == TypeOfTabTreeNode.IsArea) { this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = areaId; var areaInfo = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef; if (areaId == -1) { nodename = "全部区域"; } else { foreach (var f in areaInfo.AreaInfo) { if (f.Value.AreaId == areaId) { nodename = f.Value.AreaName; } } } } if (type == TypeOfTabTreeNode.IsGrp) { var info = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpMultiInfoHoldNew.GetGroupInfomation(AreaId, groupId); if (info != null) { nodename = info.GroupName; } this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = groupId; } this.NodeName = nodename; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.AddChild(); }
public TreeNodeItemMulitGroupViewModel(TreeNodeBaseNode mvvmFather, GroupItemsInfo.GroupItem groupInfomatioin) { this.NodeType = TypeOfTabTreeNode.IsGrp; //Visi = Visibility.Visible; this._father = mvvmFather; //TreeSingleViewModel.RegisterNodeToControl(this); if (groupInfomatioin == null) { this.NodeName = "GroupInfo Error"; return; } this.NodeName = groupInfomatioin.GroupName; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = groupInfomatioin.GroupId; this.AddChild(); }
/// <summary> /// 当选择的终端发送变化时,如果 /// </summary> public override void OnNodeSelectActive() { //base.OnNodeSelect(); //发布事件 选中当前节点 var args = new PublishEventArgs { EventType = PublishEventType.Core, EventId = EventIdAssign.GroupSelected, }; args.AddParams(NodeId); EventPublisher.EventPublish(args); // base.OnNodeSelectActive(); TreeNodeItemSingleGroupViewModel.CurrentSelectGroupNode = this; // ResetContextMenu(); }
/// <summary> /// 当分组信息发生变化的时候 增量式重新加载节点 /// </summary> public void UpdateArea() { var info = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetAreaInfo(this.AreaId); //.Values.ToList(); if (info == null) { this.ChildTreeItems.Clear(); if (_father != null) { _father.ChildTreeItems.Remove(this); } return; } this.NodeName = info.AreaName; var arealst = (from t in info.LstTml select t).ToList(); var gprlst = (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups where t.Key.Item1 == AreaId select t.Key.Item2).ToList(); //var spe = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId); //if(spe .Count >0) // gprlst.Add(0); //node delete for (int i = this.ChildTreeItems.Count - 1; i >= 0; i--) { if (ChildTreeItems[i].NodeId == 0) { continue; } if (gprlst.Contains(ChildTreeItems[i].NodeId) == false) { ChildTreeItems.RemoveAt(i); } if (ChildTreeItems[i].NodeType != TypeOfTabTreeNode.IsGrpSpecial && ChildTreeItems[i].NodeType != TypeOfTabTreeNode.IsGrp && ChildTreeItems[i].NodeType != TypeOfTabTreeNode.IsAll) { this.ChildTreeItems.RemoveAt(i); } } //tml add and update var exist = (from t in ChildTreeItems select t.NodeId).ToList(); var lstUp = new List <int>(); foreach (var t in info.LstTml) { if (exist.Contains(t)) { lstUp.Add(t); continue; } var para = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId, t); if (para == null) { continue; } if (para.LstTml.Count == 0) { continue; } ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, t, TypeOfTabTreeNode.IsGrp)); } foreach (var f in this.ChildTreeItems) { if (!lstUp.Contains(f.NodeId)) { continue; } f.ReUpdate(0); } TreeNodeBaseNode spe = null; var spelst = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId); foreach (var f in this.ChildTreeItems) { if (f.NodeType == TypeOfTabTreeNode.IsAll) { f.ReUpdate(0); } if (f.NodeType == TypeOfTabTreeNode.IsGrpSpecial) { if (spelst.Count == 0) { this.ChildTreeItems.Remove(f); break; } f.ReUpdate(0); spe = f; } } if (spe == null && spelst.Count > 0) { this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0, TypeOfTabTreeNode.IsGrpSpecial)); } }
/// <summary> /// /// </summary> /// <param name="mvvmFather"></param> /// <param name="grpInfo">grpid,grpname</param> /// <param name="type"></param> public TreeNodeItemSingleGroupViewModel(TreeNodeBaseNode mvvmFather, int areaId, int grpId, string grpName, TypeOfTabTreeNode type) { this.AreaId = areaId; this.NodeType = type; //Visi = Visibility.Visible; this._father = mvvmFather; //TreeSingleViewModel.RegisterNodeToControl(this); //记录分组 组合 id ,下级还有分组 -99,特殊分组为0 ,全部分组为 0 无视 就一个 var tukey = new Tuple <int, int, int>(0, 0, 0); var nodename = grpName; if (type == TypeOfTabTreeNode.IsGrpSpecial) { tukey = new Tuple <int, int, int>(areaId, 0, -99); nodename = "特殊终端"; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = 0; } if (type == TypeOfTabTreeNode.IsAll) { tukey = new Tuple <int, int, int>(areaId, 0, 0); nodename = "全部终端"; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = 0; } if (type == TypeOfTabTreeNode.IsArea) { tukey = new Tuple <int, int, int>(areaId, -99, -99); this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = areaId; var areaInfo = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef; foreach (var f in areaInfo.AreaInfo) { if (f.Value.AreaId == areaId) { nodename = f.Value.AreaName; } } } if (type == TypeOfTabTreeNode.IsGrp) { tukey = new Tuple <int, int, int>(areaId, grpId, -99); this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = grpId; } if (type == TypeOfTabTreeNode.IsRegion) { tukey = new Tuple <int, int, int>(areaId, mvvmFather.NodeId, grpId); this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = grpId; } if (type == TypeOfTabTreeNode.IsRegionSpecial) { tukey = new Tuple <int, int, int>(areaId, mvvmFather.NodeId, 0); nodename = "特殊终端"; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = 0; } WeakReference refs = new WeakReference(this); if (GrpRelationItems.ContainsKey(tukey) == false) { GrpRelationItems.Add(tukey, new List <WeakReference>()); } GrpRelationItems[tukey].Add(refs); this.NodeName = nodename; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.AddChild(); }
//public TreeNodeItemSingleGroupViewModel() //{ // this.NodeType = TypeOfTabTreeNode.IsGrp; // //Visi = Visibility.Visible; //} public TreeNodeItemSingleGroupViewModel(TreeNodeBaseNode mvvmFather, int areaId, int groupId, TypeOfTabTreeNode type) { this.AreaId = areaId; this.NodeType = type; //Visi = Visibility.Visible; this._father = mvvmFather; //TreeSingleViewModel.RegisterNodeToControl(this); var nodename = "--"; if (type == TypeOfTabTreeNode.IsGrpSpecial) { nodename = "特殊终端"; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = 0; } if (type == TypeOfTabTreeNode.IsRegionSpecial) { nodename = "特殊终端"; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = 0; } if (type == TypeOfTabTreeNode.IsAll) { nodename = "全部终端"; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = 0; } if (type == TypeOfTabTreeNode.IsArea) { this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = areaId; var areaInfo = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef; foreach (var f in areaInfo.AreaInfo) { if (f.Value.AreaId == areaId) { nodename = f.Value.AreaName; } } } if (type == TypeOfTabTreeNode.IsGrp) { var info = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId, groupId); if (info != null) { nodename = info.GroupName; } this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.NodeId = groupId; } this.NodeName = nodename; this.ImagesIcon = ImageResources.GroupIcon; // ImageSource.GrpBitmapImage; this.AddChild(); //if (ChildTreeItems.Count == 0) //{ // if (mvvmFather != null) // { // bool flag = false; // do // { // flag = false; // for (int i = 0; i < mvvmFather.ChildTreeItems.Count; i++) // { // if (mvvmFather.ChildTreeItems[i].ChildTreeItems.Count == 0) // { // mvvmFather.DeleteChild(i); // flag = true; // break; // } // } // } while (flag == true); // } //} }
public override void OnNodeSelectActive() { base.OnNodeSelectActive(); CurrentSelectGroupNode = this; }