private void TagAllNodesForDeletion(IBuildTreeNode tree, List <IBuildTreeNode> taggedNodes) { foreach (var node in tree.Children) { taggedNodes.Add(node); TagAllNodesForDeletion(node, taggedNodes); } }
protected BuildTreeNodeViewModel(IBuildTreeNode nodeSource) { NodeSource = nodeSource; Children = new RemoveTrackingObservableCollection <BuildTreeNodeViewModel>(TimeSpan.FromSeconds(0.8)); Children.CollectionChanged += ChildrenOnCollectionChanged; SetChildrenSorting(_currentSortingDefinition); CurrentTreeLevelDepth = nodeSource.Depth; }
public override void UpdateWithValuesFrom(IBuildTreeNode nodeToInsert) { if (!(nodeToInsert is IBuildNode otherBuild)) { return; } UpdateProperties(otherBuild.Build); }
protected BuildTreeNodeViewModel(IBuildTreeNode nodeSource) { NodeSource = nodeSource; Children = new RemoveTrackingObservableCollection <BuildTreeNodeViewModel>(TimeSpan.FromSeconds(0.8)); Children.CollectionChanged += ChildrenOnCollectionChanged; SetChildrenSorting(_currentSortingDefinition); RemoveOneChildCommand = new DelegateCommand(RemoveOneChild); AddAndRemoveCommand = new DelegateCommand(o => { RemoveOneChild(o); }); HighlightCommand = new DelegateCommand(Highlight); }
public override void UpdateWithValuesFrom(IBuildTreeNode nodeToInsert) { var otherBuild = (nodeToInsert as IBuildNode)?.Build; if (otherBuild == null) { return; } UpdateProperties(otherBuild); }
private void RemoveTaggedNodes(IBuildTreeNode tree, List <IBuildTreeNode> taggedNodes) { foreach (var node in tree.Children.ToList()) { if (taggedNodes.Any(x => ReferenceEquals(x, node))) { tree.RemoveChild(node); } else { RemoveTaggedNodes(node, taggedNodes); } } }
private void RemoveTaggedNodes(IBuildTreeNode tree, List <IBuildTreeNode> taggedNodes) { foreach (var node in tree.Children.ToList()) { if (taggedNodes.Contains(node)) { tree.RemoveChild(node); } else { RemoveTaggedNodes(node, taggedNodes); } } }
private void Merge(IBuildTreeNode tree, IBuildTreeNode path) { var target = tree.Children.FirstOrDefault(c => c == path); if (target == null) { tree.AddChild(path); } else { foreach (var child in path.Children) { Merge(target, child); } } }
private void CutTree(IBuildTreeNode tree) { var buildChildrenToRemove = tree.Children.OfType <IBuildNode>() .OrderByDescending(x => x.Build.LastChangedTime ?? DateTime.MinValue) .Skip(_configuration.BuildsToShow) .ToList(); foreach (var node in buildChildrenToRemove) { tree.RemoveChild(node); } foreach (var child in tree.Children) { CutTree(child); } }
private static BuildTreeNodeViewModel AsViewModel(IBuildTreeNode node, GroupDefinition groupDefinition) { switch (groupDefinition) { case GroupDefinition.Branch: return(new BranchGroupNodeViewModel((IBranchGroupNode)node)); case GroupDefinition.BuildDefinition: return(new DefinitionGroupNodeViewModel((IDefinitionGroupNode)node)); case GroupDefinition.Source: return(new SourceGroupNodeViewModel((ISourceGroupNode)node)); case GroupDefinition.Status: return(new StatusGroupNodeViewModel(node)); default: return(new BuildNodeViewModel((IBuildNode)node) { IsLargeSize = false }); } }
private void Merge(IBuildTreeNode tree, IBuildTreeNode nodeToInsert, List <IBuildTreeNode> taggedNodes) { var insertTarget = tree; var subTree = insertTarget.Children.FirstOrDefault(node => node.Equals(nodeToInsert)); if (subTree != null) { subTree.UpdateWithValuesFrom(nodeToInsert); if (nodeToInsert.Children.Any()) { Merge(subTree, nodeToInsert.Children.First(), taggedNodes); } taggedNodes.Remove(subTree); } else { tree.AddChild(nodeToInsert); taggedNodes.Remove(tree); } }
public void RemoveChild(IBuildTreeNode node) { _childList.RemoveAll(x => ReferenceEquals(x, node)); }
public void AddChild(IBuildTreeNode node) { _childList.Add(node); }
public StatusGroupNodeViewModel(IBuildTreeNode node) : base(node) { }
public abstract bool Equals(IBuildTreeNode other);
public override bool Equals(IBuildTreeNode other) { return(Definition.Id.Equals((other as DefinitionGroupNode)?.Definition?.Id)); }
public override bool Equals(IBuildTreeNode other) => base.Equals(other) && Definition.Id.Equals((other as DefinitionGroupNode)?.Definition.Id, StringComparison.InvariantCulture);
public override bool Equals(IBuildTreeNode other) { return(base.Equals(other) && BranchName.Equals((other as BranchGroupNode)?.BranchName, StringComparison.InvariantCulture)); }
public virtual void UpdateWithValuesFrom(IBuildTreeNode nodeToInsert) { }
public BuildTreeParser(IBuildTreeNode tree) { _tree = tree; }
public override bool Equals(IBuildTreeNode other) { return(BranchName.Equals((other as BranchGroupNode)?.BranchName)); }
public override bool Equals(IBuildTreeNode other) => base.Equals(other) && Build.Id.Equals((other as BuildNode)?.Build.Id, StringComparison.InvariantCulture);
public override void UpdateWithValuesFrom(IBuildTreeNode nodeToInsert) { BranchName = (nodeToInsert as BranchGroupNode)?.BranchName ?? string.Empty; }
public void RemoveChild(IBuildTreeNode node) { _childList.Remove(node); }
public BuildTreeViewModel(IBuildTreeNode tree) : base(tree) { _sortingDefinition = new BuildTreeSortingDefinition(); }
public override bool Equals(IBuildTreeNode other) { return(SourceName.Equals((other as SourceGroupNode)?.SourceName)); }
public override bool Equals(IBuildTreeNode other) { return(Build.Id.Equals((other as BuildNode)?.Build?.Id)); }
public override bool Equals(IBuildTreeNode other) { throw new NotImplementedException(); }