public override void TestInitialize() { base.TestInitialize(); base.OpenSolution(GetFullPath(TestContext.TestDeploymentDir, "SampleSolution\\SampleSolution.sln")); var adapter = new Mock <IAdapterService>(); //adapter.Setup(x => x.As<ISolutionNode>(It.IsAny<object>())) // .Returns<object>(o => (ISolutionNode)o); adapter.Setup(x => x.Adapt(It.IsAny <object>())) .Returns <object>(o => Mock.Of <IAdaptable <object> >(a => a.As <ISolutionNode>() == (ISolutionNode)o)); var solution = ServiceProvider.GetService <IVsSolution>(); var hierarchy = solution as IVsHierarchy; var factory = new Mock <ITreeNodeFactory <IVsSolutionHierarchyNode> >(); factory.Setup(x => x.Supports(It.IsAny <IVsSolutionHierarchyNode>())).Returns(true); factory.Setup(x => x.CreateNode(It.IsAny <Lazy <ITreeNode> >(), It.IsAny <IVsSolutionHierarchyNode>())) .Returns <Lazy <ITreeNode>, IVsSolutionHierarchyNode>((parent, node) => new CustomSolutionNode( node, parent, factory.Object, adapter.Object)); this.node = new CustomSolutionNode( new VsSolutionHierarchyNode(hierarchy, VSConstants.VSITEMID_ROOT), null, factory.Object, Mock.Of <IAdapterService>()); }
private TreeNode Wrap(Solution solution) { TreeNode tn = new SolutionTreeNode(solution); foreach (Project p in solution.Projects) { tn.Nodes.Add(this.Wrap(p)); } return(tn); }
public static EditScreenWindow GetInstance(SolutionTreeNode node) { EditScreenWindow retVal = null; if (instance.ContainsKey(node.Key)) { retVal = instance[node.Key]; } else { retVal = RenderScreen(node, retVal); } return(retVal); }
private static Dictionary <string, SolutionTreeNode> BuildSolutionFlatTree(SolutionFile solutionFile) { var projectByPath = new Dictionary <string, SolutionTreeNode>(StringComparer.OrdinalIgnoreCase); var projectsByGuid = new Dictionary <string, SolutionTreeNode>(StringComparer.OrdinalIgnoreCase); foreach (var project in solutionFile.Projects) { projectsByGuid[project.Key] = new SolutionTreeNode(project.Value); } if (solutionFile.Global.Sections.TryGetValue(("NestedProjects", "preSolution"), out var section)) { foreach (var keyValue in section.Values) { var projectGuid = keyValue.Key; var parentProjectGuid = keyValue.Value; if (!projectsByGuid.ContainsKey(projectGuid)) { // Project has been removed from the base solution. if (!solutionFile.Projects.ContainsKey(projectGuid)) { continue; } projectsByGuid[projectGuid] = new SolutionTreeNode(solutionFile.Projects[projectGuid]); } if (!projectsByGuid.ContainsKey(parentProjectGuid)) { projectsByGuid[parentProjectGuid] = new SolutionTreeNode(solutionFile.Projects[parentProjectGuid]); } projectsByGuid[projectGuid].Parent = projectsByGuid[parentProjectGuid]; projectsByGuid[parentProjectGuid].Children.Add(projectsByGuid[projectGuid]); } } foreach (var slnNode in projectsByGuid.Values) { projectByPath[slnNode.Path] = slnNode; } return(projectByPath); }
internal static IViewModel Create(this SolutionTreeNode modelEntity) { return(Factory.Create(modelEntity)); }
private static EditScreenWindow RenderScreen(SolutionTreeNode node, EditScreenWindow retVal) { EditScreen Me = (EditScreen)node.Object; RadPropertyGrid propertyGrid = new RadPropertyGrid(); propertyGrid = new RadPropertyGrid(); propertyGrid.Dock = DockStyle.Fill; propertyGrid.SelectedObject = node.Object; propertyGrid.ToolbarVisible = true; propertyGrid.PropertySort = PropertySort.Categorized; EditScreenWindow window = new EditScreenWindow(propertyGrid); window.Key = node.Key; window.Tag = node; window.Text = node.Text; window.editors = GetCustomEditors(node.Object); window.onValueChangedCommands = GetValueChangedCommands(node.Object); //window.Controls.Add(window.PropertyGrid); TableLayoutPanel screen = new TableLayoutPanel(); screen.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; screen.ColumnCount = 1; screen.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); screen.RowCount = 3; screen.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 45F)); screen.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); screen.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); screen.Dock = DockStyle.Fill; //add textbox for title TextBox title = new TextBox(); title.Font = new System.Drawing.Font("Verdana", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); screen.Controls.Add(title, 0, 0); title.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); title.Location = new System.Drawing.Point(0, 0); title.DataBindings.Add("Text", Me, "Title.Name"); //add textbox for subtitle TextBox subtitle = new TextBox(); screen.Controls.Add(subtitle, 0, 1); subtitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); subtitle.Location = new System.Drawing.Point(0, 0); subtitle.DataBindings.Add("Text", Me, "SubTitle.Name"); TableLayoutPanel zoneContainer = SetupSectionZoneLayout(Me); screen.Controls.Add(zoneContainer, 0, 2); window.Controls.Add(screen); instance.Add(node.Key, window); retVal = window; return(retVal); }
public IViewModel Create(SolutionTreeNode modelEntity) { return(new UAModelDesignerSolutionWrapper(modelEntity)); }