/// <summary> /// Updates or creates new IProjectItemTree node /// </summary> private IProjectTree CreateOrUpdateProjectItemTreeNode( IProjectTree node, IDependencyViewModel viewModel, IRule rule, ProjectTreeFlags?additionalFlags = null, ProjectTreeFlags?excludedFlags = null) { if (node == null) { var flags = FilterFlags(viewModel.Flags, additionalFlags, excludedFlags); var filePath = (viewModel.OriginalModel != null && viewModel.OriginalModel.TopLevel && viewModel.OriginalModel.Resolved) ? viewModel.OriginalModel.GetTopLevelId() : viewModel.FilePath; var itemContext = ProjectPropertiesContext.GetContext( CommonServices.Project, file: filePath, itemType: viewModel.SchemaItemType, itemName: filePath); node = TreeServices.CreateTree( caption: viewModel.Caption, itemContext: itemContext, propertySheet: null, visible: true, browseObjectProperties: rule, flags: viewModel.Flags, icon: viewModel.Icon.ToProjectSystemType(), expandedIcon: viewModel.ExpandedIcon.ToProjectSystemType()); } else { node = UpdateTreeNode(node, viewModel, rule); } return(node); }
/// <summary> /// Updates or creates new node /// </summary> private async Task <IProjectTree> CreateOrUpdateNodeAsync( IProjectTree node, IDependency dependency, ITargetedDependenciesSnapshot targetedSnapshot, IProjectCatalogSnapshot catalogs, bool isProjectItem, ProjectTreeFlags?additionalFlags = null, ProjectTreeFlags?excludedFlags = null) { IRule rule = null; if (dependency.Flags.Contains(DependencyTreeFlags.SupportsRuleProperties)) { rule = await TreeServices.GetRuleAsync(dependency, catalogs); } return(CreateOrUpdateNode( node, dependency.ToViewModel(targetedSnapshot), rule, isProjectItem, additionalFlags, excludedFlags)); }