public void AddChild(LayersTreeViewItem item) { if (this.ChildItems == null) { this.ChildItems = new ObservableCollection <LayersTreeViewItem>(); } ChildItems.Add(item); }
public MenuItem AddMenuItem(params MenuItem[] menuItem) { foreach (var mi in menuItem) { mi.Parent = this; ChildItems.Add(mi); } return(this); }
public BurgerMenuPopupViewItem AddChildPopupItem(string key, Type pageViewType) { BurgerMenuPopupViewItem popupItem = new BurgerMenuPopupViewItem(string.Format("{0}.{1}", Key, key), pageViewType); ChildItems.Add(popupItem); return(popupItem); }
public TreeItemViewModel( TextSpan textSpan, SourceText sourceText, DocumentId documentId, string fileName, Glyph glyph, ImmutableArray <ClassifiedSpan> classifiedSpans, ValueTrackingTreeViewModel treeViewModel, IGlyphService glyphService, IThreadingContext threadingContext, Workspace workspace, ImmutableArray <TreeItemViewModel> children = default) : base() { FileName = fileName; TextSpan = textSpan; _sourceText = sourceText; ClassifiedSpans = classifiedSpans; TreeViewModel = treeViewModel; ThreadingContext = threadingContext; _glyph = glyph; _glyphService = glyphService; Workspace = workspace; DocumentId = documentId; if (!children.IsDefaultOrEmpty) { foreach (var child in children) { ChildItems.Add(child); } } sourceText.GetLineAndOffset(textSpan.Start, out var lineStart, out var _); sourceText.GetLineAndOffset(textSpan.End, out var lineEnd, out var _); LineSpan = LineSpan.FromBounds(lineStart, lineEnd); PropertyChanged += (s, e) => { if (e.PropertyName == nameof(IsLoading)) { NotifyPropertyChanged(nameof(ShowGlyph)); } }; TreeViewModel.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(TreeViewModel.HighlightBrush)) { // If the highlight changes we need to recalculate the inlines so the // highlighting is correct NotifyPropertyChanged(nameof(Inlines)); } }; }
/// <summary> /// 更新组下所有设备的参数 位置 增删改等 /// </summary> private void UpdateChildPara() { var child = Wlst.Sr.SlusglInfoHold.Services.SluSglFieldGrpHold.MySlef.Get(NodeId); if (child == null) { this.ChildItems.Clear(); return; } var lst = (from t in child where t.CtrlLst.Count > 0 select t.GrpId).ToList(); //delete var dlt = (from t in ChildItems where lst.Contains(t.NodeId) == false select t).ToList(); foreach (var f in dlt) { if (ChildItems.Contains(f)) { ChildItems.Remove(f); } } var dic = new List <int>(); //update setinfo foreach (var f in ChildItems) { f.UpdateShowInfo(); dic.Add(f.NodeId); } //newadd foreach (var f in lst) { if (dic.Contains(f)) { continue; } ChildItems.Add(new FieldGrpNodeItem(NodeId, f)); } this.Sort(lst); ////add and sort //for (int i = 0; i < lst.Count; i++) //{ // int cur = lst[i]; // if (ChildItems.Count < i + 1) ChildItems.Add(dic[cur]); // else if (ChildItems[i].NodeId != cur) ChildItems.Insert(i, dic[cur]); //} //for (int i = ChildItems.Count - 1; i >= 0; i--) //{ // if (ChildItems[i].ChildItems.Count == 0) ChildItems.RemoveAt(i); //} }
/// <summary> /// 添加子项 /// </summary> /// <param name="resource"></param> public void AppendSubResult(IResourceInfo resource) { if (ChildItems.Cast <ResourceListViewItem>().Any(s => s.Resource.Provider == resource) || (Resource != null && Resource.Provider == resource.Provider)) { return; } if (!_subItemCreated) { _subItemCreated = true; var res = Resource; ChildItems.Add(new ResourceListViewItem(res, true)); //重置图标 ImageKey = "torrent_multi"; IsBold = true; } //设置资源大小 if (Resource.DownloadSizeCalcauted == 0L) { Resource.DownloadSize = resource.DownloadSize; Resource.DownloadSizeValue = resource.DownloadSizeValue; SubItems[3].Text = resource.DownloadSizeValue == null ? (resource.DownloadSizeCalcauted == 0L ? resource.DownloadSize.DefaultForEmpty("<未知>") : resource.DownloadSizeCalcauted.ToSizeDescription()) : resource.DownloadSizeValue.Value.ToSizeDescription(); } if (Resource.SupportPreivewType == PreviewType.None) { Resource.PreviewInfo = Resource.PreviewInfo ?? resource.PreviewInfo; Resource.SupportPreivewType = resource.SupportPreivewType; Resource_PreviewTypeChanged(this, null); } //状态 if (Resource.VerifyState == VerifyState.Unknown || Resource.VerifyState == VerifyState.None) { if (resource.VerifyState != VerifyState.Unknown && resource.VerifyState != VerifyState.None) { Resource.ChangeVerifyState(resource.VerifyState, resource.ReportNum); } } else { resource.ChangeVerifyState(Resource.VerifyState, Resource.ReportNum); } if (resource.Downloaded || Resource.Downloaded) { resource.ChangeDownloadedStatus(true); Resource.ChangeDownloadedStatus(true); } ChildItems.Add(new ResourceListViewItem(resource, true)); CheckRowStyle(); }
public ResourceListViewItem(IResourceInfo resource, bool multiEngine) { Resource = resource; MultiEngine = multiEngine; //初始化结构 Text = resource.Title.GetSubString(100); SubItems.AddRange(new[] { "", "", resource.HasSubResources ? "(多个资源)" : resource.DownloadSizeValue == null ? (resource.DownloadSizeCalcauted == 0L ? resource.DownloadSize.DefaultForEmpty("<未知>") : resource.DownloadSizeCalcauted.ToSizeDescription()) : resource.DownloadSizeValue.Value.ToSizeDescription(), resource.FileCount == null ? "----" : resource.FileCount.Value.ToString("N0"), "", resource.UpdateTime.HasValue ? resource.UpdateTime.Value.ToString("yyyy-MM-dd") : resource.UpdateTimeDesc }); Resource_PreviewTypeChanged(this, null); UseItemStyleForSubItems = true; ImageKey = resource.HasSubResources ? "multiresource" : multiEngine ? "e_" + resource.Provider.Info.Name : GetImageKey(resource); //初始化标记 RefreshItemMask(); if (!resource.IsHashLoaded) { Resource.DetailLoaded += Resource_DetailLoaded; } else { RefreshDownloadStatus(); RefreshIllegalStatus(); } resource.PreviewTypeChanged += Resource_PreviewTypeChanged; CheckRowStyle(); IsExpanded = false; if (resource.HasSubResources) { //多个资源项 if (resource.SubResources == null) { ChildItems.Add(new PaddingLoadingItem()); resource.SubResourceLoaded += (s, e) => AppContext.UiInvoke(LoadSubResources); } else { LoadSubResources(); IsExpanded = true; } } }
public BookmarkItem(Bookmarks.BookmarkItem bookmarkItem, int level) { Level = level; Core = bookmarkItem; if (bookmarkItem.ChildItems != null) { foreach (var childItem in bookmarkItem.ChildItems) { ChildItems.Add(new BookmarkItem(childItem, Level + 1)); } } }
public BurgerMenuCommandItem AddChildCommandItem(string key, string menuTitle, CachyFont.Glyph glyph, string methodName) { BurgerMenuCommandItem commandItem = new BurgerMenuCommandItem(string.Format("{0}.{1}", Key, key), menuTitle, glyph, this, methodName); ChildItems.Add(commandItem); return(commandItem); }
public override void AddItem(IScreenItem item) { var childItem = item as TreeItem <T>; if (childItem != null) { //if this is child tree item, add it special ChildItems.Add(childItem); } else { base.AddItem(item); } }
public BurgerMenuViewItem AddChildViewItem(string key, string menuTitle, CachyFont.Glyph glyph, string pageTitle, Type pageViewType, bool clearInstanceOnNavigate) { BurgerMenuViewItem viewItem = new BurgerMenuViewItem(string.Format("{0}.{1}", Key, key), menuTitle, glyph, pageTitle, pageViewType, clearInstanceOnNavigate); ChildItems.Add(viewItem); return(viewItem); }
private void SearchChild() { if (string.IsNullOrWhiteSpace(XPath.SelectItem) == false) { List <HtmlNode> nodes = null; ControlExtended.SafeInvoke( () => nodes = HtmlDoc.DocumentNode.SelectNodesPlus(XPath.SelectItem, SelectorFormat.XPath).ToList()); ChildItems.Clear(); if (nodes == null) { XLogSys.Print.Info(GlobalHelper.Get("key_665")); return; } nodes.Execute(d => ChildItems.Add(new CrawlItem { XPath = d.XPath, SampleData1 = d.InnerHtml })); } }
public void Sort(List <int> sortlst) { var slsdfs = (from t in ChildItems where sortlst.Contains(t.NodeId) select t.NodeId).ToList(); var st = (from t in sortlst where slsdfs.Contains(t) select t).Distinct().ToList(); var notex = (from t in ChildItems where st.Contains(t.NodeId) == false select t).ToList(); foreach (var f in notex) { if (ChildItems.Contains(f)) { ChildItems.Remove(f); } } for (int i = 0; i < ChildItems.Count; i++) { if (ChildItems[i].NodeId == st[i]) { continue; } foreach (var l in ChildItems) { if (l.NodeId == st[i]) { var tmp = l; ChildItems.Remove(l); ChildItems.Insert(i, tmp); break; } } } foreach (var f in notex) { ChildItems.Add(f); } }
public Ship(World world, Vector2 position, float rotation, Faction faction, int id) : base(world) { //初始化数据 base.Position = position; positionl = position; base.Rotation = rotation; this.faction = faction; this.id = id; //如果要将Ship类作为抽象类并创建多个种类的船则删除以下信息 maxSpeed = 25f; acceleration = 10f; ChildItems.Add(new Sail(world, this, new Vector2(0, 0), faction, 1f)); //ChildItems.Add(new Sail(world, this, new Vector2(0,-109),faction,0.5f)); //ChildItems.Add(new Sail(world, this, new Vector2(0, 34), faction, 0.75f)); this.Texture = @"Ship"; Scale = 0.15f; boundingRadius = 15f; angularRate = 45f; rangeOfView = 400f; addWaveSpan = 1f; ChildItems.Add(new Cannon(world, this, 90)); cannons.Add((Cannon)ChildItems.LatestAddedItem); ChildItems.Add(new Cannon(world, this, -90)); cannons.Add((Cannon)ChildItems.LatestAddedItem); selectionRadius = 50f; selectionTexture = GameOperators.Content.Load <Texture2D>(@"Circle1"); selectionTextureCenter = new Vector2(selectionTexture.Width / 2, selectionTexture.Height / 2); if (selectionTexture.Width > 0) { selectionTextureScale = selectionRadius / selectionTexture.Width * 1.3f; } }
//1、区域,2、分组,3、全部设备,4、特殊设备 private void UpdateChildPara() { var lstneworder = new List <int>(); if (NodeType == 2) //grp { var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId, NodeId); if (grp != null) { lstneworder = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml); } } if (NodeType == 3) //all { var grp = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetAreaInfo(AreaId); if (grp != null) { var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml, AreaId, true); foreach (var f in gprs.Item1) { lstneworder.AddRange(gprs.Item1); } lstneworder.AddRange( Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(gprs.Item2)); } } if (NodeType == 4) //spe { var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId); if (grp.Count == 0) { return; } lstneworder.AddRange( Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp)); } if (NodeType >= 2 && NodeType <= 4) { var tmlLst = (from t in Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Info where t.Value.AreaId == AreaId && lstneworder.Contains(t.Key) select t.Key).ToList(); //delete var dlt = (from t in ChildItems where tmlLst.Contains(t.NodeId) == false select t).ToList(); foreach (var f in dlt) { if (ChildItems.Contains(f)) { ChildItems.Remove(f); } } var dic = new List <int>(); //update setinfo foreach (var f in ChildItems) { f.UpdateShowInfo(); dic.Add(f.NodeId); } //newadd foreach (var f in tmlLst) { if (dic.Contains(f)) { continue; } ChildItems.Add(new FieldNodeItem(f)); } this.Sort(tmlLst); ////add and sort //for (int i = 0; i < tmlLst.Count; i++) //{ // int cur = tmlLst[i]; // if (ChildItems.Count < i + 1) ChildItems.Add(dic[cur]); // else if (ChildItems[i].NodeId != cur) ChildItems.Insert(i, dic[cur]); //} } for (int i = ChildItems.Count - 1; i >= 0; i--) { if (ChildItems[i].ChildItems.Count == 0) { ChildItems.RemoveAt(i); } } }
public BurgerMenuViewItem AddChildViewItem(BurgerMenuViewItem item) { ChildItems.Add(item); return(item); }
public override void Add(string key, View value) { // value._map._parentReferenceValue = () => ComputedValue; ChildItems.Add(key, value); }
public void AddChild(Child item) { item.Level = Level + 1; ChildItems.Add(item); Console.WriteLine("[{0}] added to Parent [{1}]", item, ChildName); }
public BurgerMenuCommandItem AddChildCommandItem(BurgerMenuCommandItem item) { ChildItems.Add(item); return(item); }
virtual public void AddChildItem(ItemModel Item) { ChildItems.Add(Item); Item.Parent = this; }
public void Add(IItem item) { ChildItems.Add(item); }
private void UpdateChildPara() { var allgrp = this.ChildItems[0]; allgrp.SortIndex = 0; //allgrp.UpdateShowInfo(); var spegrp = this.ChildItems[ChildItems.Count - 1]; spegrp.SortIndex = 99999; //spegrp.UpdateShowInfo(); var grpLst = (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups where t.Key.Item1 == AreaId orderby t.Value.Index select t.Value.GroupId).ToList(); //var tmlLst = // (from t in Wlst.Sr.SlusglInfoHold.Services.SluSglFieldHold.MySlef.Info // where t.Value.AreaId == AreaId && lstneworder.Contains(t.Key) // select t.Key).ToList(); //delete var dlt = (from t in ChildItems where t.NodeId != 0 && grpLst.Contains(t.NodeId) == false select t).ToList(); foreach (var f in dlt) { if (ChildItems.Contains(f)) { ChildItems.Remove(f); } } //update setinfo foreach (var f in ChildItems) { f.UpdateShowInfo(); } //newadd var ex = (from t in ChildItems select t.NodeId).ToList(); var newadd = (from t in grpLst where ex.Contains(t) == false select t).ToList(); foreach (var f in newadd) { ChildItems.Add(new RtuGrpItem(AreaId, f, 2)); } grpLst.Insert(0, 0); grpLst.Add(99999); this.Sort(grpLst); ////sort //var dic = new Dictionary<int, int>(); //for (int i = 0; i <= grpLst.Count; i++) //{ // if (dic.ContainsKey(grpLst[i]) == false) dic.Add(grpLst[i], i + 3); //} //foreach (var f in ChildItems) //{ // if (dic.ContainsKey(f.NodeId)) f.SortIndex = dic[f.NodeId]; //} //this.ChildItems = (from t in ChildItems orderby t.SortIndex ascending select t).ToList(); for (int i = ChildItems.Count - 1; i >= 0; i--) { if (ChildItems[i].ChildItems.Count == 0) { ChildItems.RemoveAt(i); } } }