private void designer1_ElementResizing(object sender, ElementEventArgs e) { if (designer1.Document.SelectedElements[0].GetType() == typeof(MFRectangleNode)) { MFRectangleNode rn = (MFRectangleNode)e.Element; rn.Label.Location = rn.Location; rn.Label.Size = rn.Size; } }
private void EditElement() { if (designer1.Document.SelectedElements.Count == 1) { if (designer1.Document.SelectedElements[0].GetType() == typeof(MFRectangleNode)) { MFRectangleNode RectNode = (MFRectangleNode)designer1.Document.SelectedElements[0]; ComponentWrapper comp = (ComponentWrapper)RectNode.Tag; this.OnEditEvent(comp); } } }
private void analizeReferencesToolStripMenuItem_Click(object sender, EventArgs e) { if (designer1.Document.SelectedElements.Count == 1) { if (designer1.Document.SelectedElements[0].GetType() == typeof(MFRectangleNode)) { MFRectangleNode RectNode = (MFRectangleNode)designer1.Document.SelectedElements[0]; ComponentWrapper comp = (ComponentWrapper)RectNode.Tag; collection.AnalyseComponent(comp); Visualize(collection); } } }
private MFRectangleNode AddNodeElement(string caption, ComponentTypeWrapper type, Point location, object tag) { MFRectangleNode rn = new MFRectangleNode(location, new Size(100, 50)); rn.Tag = tag; switch (type) { case ComponentTypeWrapper.Library: LibraryWrapper l = PK.Wrapper.FindLibrary((ComponentWrapper)tag); if (l != null) { if (l.IsStub) { rn.FillColor1 = Color.Gray; rn.FillColor2 = Color.White; } else { rn.FillColor1 = Color.LightSteelBlue; rn.FillColor2 = Color.White; } } else { rn.FillColor1 = Color.LightSteelBlue; rn.FillColor2 = Color.White; } break; case ComponentTypeWrapper.Feature: rn.FillColor1 = Color.Khaki; rn.FillColor2 = Color.White; break; case ComponentTypeWrapper.MFAssembly: break; case ComponentTypeWrapper.MFSolution: break; case ComponentTypeWrapper.Processor: break; case ComponentTypeWrapper.OperatingSystem: break; case ComponentTypeWrapper.BuildTool: break; case ComponentTypeWrapper.ISA: break; case ComponentTypeWrapper.BuildParameter: break; case ComponentTypeWrapper.LibraryCategory: rn.FillColor1 = Color.LightGreen; rn.FillColor2 = Color.White; break; case ComponentTypeWrapper.Unknown: break; default: break; } rn.Label.ReadOnly = true; rn.Label.Text = caption; rn.Label.Location = rn.Location; rn.Label.Size = rn.Size; designer1.Document.AddElement(rn); UpdateScrolls(); return rn; }
private void showPropertiesToolStripMenuItem_Click(object sender, EventArgs e) { if (designer1.Document.SelectedElements.Count == 1) { if (designer1.Document.SelectedElements[0].GetType() == typeof(MFRectangleNode)) { MFRectangleNode RectNode = (MFRectangleNode)designer1.Document.SelectedElements[0]; ComponentWrapper comp = (ComponentWrapper)RectNode.Tag; switch (comp.ComponentType) { case ComponentTypeWrapper.Library: LibraryWrapper lib = PK.Wrapper.FindLibrary(comp.Guid); if (lib != null) { this.OnShowPropertiesEvent(lib); } break; case ComponentTypeWrapper.Feature: FeatureWrapper feat = PK.Wrapper.FindFeature(comp.Guid); if (feat != null) { this.OnShowPropertiesEvent(feat); } break; case ComponentTypeWrapper.MFAssembly: break; case ComponentTypeWrapper.MFSolution: break; case ComponentTypeWrapper.Processor: break; case ComponentTypeWrapper.OperatingSystem: break; case ComponentTypeWrapper.BuildTool: break; case ComponentTypeWrapper.ISA: break; case ComponentTypeWrapper.BuildParameter: break; case ComponentTypeWrapper.LibraryCategory: LibraryCategoryWrapper libcat = PK.Wrapper.FindLibraryCategory(comp.Guid); if (libcat != null) { this.OnShowPropertiesEvent(libcat); } break; case ComponentTypeWrapper.Unknown: break; default: break; } } } }
private void designer1_ElementSelection(object sender, ElementSelectionEventArgs e) { if (e.Elements.Count > 0) { if (e.Elements[0].GetType() == typeof(MFRectangleNode)) { MFRectangleNode RectNode = (MFRectangleNode)e.Elements[0]; ComponentWrapper comp = (ComponentWrapper)RectNode.Tag; switch (comp.ComponentType) { case ComponentTypeWrapper.Library: LibraryWrapper lib = PK.Wrapper.FindLibrary(comp.Guid); if (lib != null) { this.OnSelectionChangeEvent(lib); } break; case ComponentTypeWrapper.Feature: FeatureWrapper feat = PK.Wrapper.FindFeature(comp.Guid); if (feat != null) { this.OnSelectionChangeEvent(feat); } break; case ComponentTypeWrapper.MFAssembly: break; case ComponentTypeWrapper.MFSolution: break; case ComponentTypeWrapper.Processor: break; case ComponentTypeWrapper.OperatingSystem: break; case ComponentTypeWrapper.BuildTool: break; case ComponentTypeWrapper.ISA: break; case ComponentTypeWrapper.BuildParameter: break; case ComponentTypeWrapper.LibraryCategory: LibraryCategoryWrapper libcat = PK.Wrapper.FindLibraryCategory(comp.Guid); if (libcat != null) { this.OnSelectionChangeEvent(libcat); } break; case ComponentTypeWrapper.Unknown: break; default: break; } } } }
private MFRectangleNode AddNodeElement(string caption, ComponentTypeWrapper type, Point location, object tag) { MFRectangleNode rn = new MFRectangleNode(location, new Size(100, 50)); rn.Tag = tag; switch (type) { case ComponentTypeWrapper.Library: LibraryWrapper l = PK.Wrapper.FindLibrary((ComponentWrapper)tag); if (l != null) { if (l.IsStub) { rn.FillColor1 = Color.Gray; rn.FillColor2 = Color.White; } else { rn.FillColor1 = Color.LightSteelBlue; rn.FillColor2 = Color.White; } } else { rn.FillColor1 = Color.LightSteelBlue; rn.FillColor2 = Color.White; } break; case ComponentTypeWrapper.Feature: rn.FillColor1 = Color.Khaki; rn.FillColor2 = Color.White; break; case ComponentTypeWrapper.MFAssembly: break; case ComponentTypeWrapper.MFSolution: break; case ComponentTypeWrapper.Processor: break; case ComponentTypeWrapper.OperatingSystem: break; case ComponentTypeWrapper.BuildTool: break; case ComponentTypeWrapper.ISA: break; case ComponentTypeWrapper.BuildParameter: break; case ComponentTypeWrapper.LibraryCategory: rn.FillColor1 = Color.LightGreen; rn.FillColor2 = Color.White; break; case ComponentTypeWrapper.Unknown: break; default: break; } rn.Label.ReadOnly = true; rn.Label.Text = caption; rn.Label.Location = rn.Location; rn.Label.Size = rn.Size; designer1.Document.AddElement(rn); UpdateScrolls(); return(rn); }
private void Visualize(HierarchyCollection collection) { designer1.Document.SelectAllElements(); designer1.Document.DeleteSelectedElements(); designer1.Document.ClearSelection(); ResetZoom(); int FeatureLineY = 50; int LibraryCategoryLineY = 150; int LibraryLineY = 250; int ElementDistance = 150; int count = 1; foreach (ComponentWrapper comp in collection.Librares) { LibraryWrapper LW = PK.Wrapper.FindLibrary(comp.Guid); if ((LW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(LW.Name, comp.ComponentType, new Point(count * ElementDistance, LibraryLineY), comp); } count++; } count = 1; foreach (ComponentWrapper comp in collection.LibraryCategories) { LibraryCategoryWrapper LCW = PK.Wrapper.FindLibraryCategory(comp.Guid); if ((LCW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(LCW.Name, comp.ComponentType, new Point(count * ElementDistance, LibraryCategoryLineY), comp); } count++; } count = 1; foreach (ComponentWrapper comp in collection.Featuries) { FeatureWrapper FW = PK.Wrapper.FindFeature(comp.Guid); if ((FW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(FW.Name, comp.ComponentType, new Point(count * ElementDistance, FeatureLineY), comp); } count++; } foreach (HierarchyCollection.Link link in collection.Links) { MFRectangleNode StartNode = null; MFRectangleNode EndNode = null; foreach (BaseElement element in designer1.Document.Elements) { if (element.GetType() == typeof(MFRectangleNode)) { MFRectangleNode RectNode = (MFRectangleNode)element; if (link.StartComponent.Guid.ToLower() == ((ComponentWrapper)RectNode.Tag).Guid.ToLower()) { StartNode = RectNode; } if (link.EndComponent.Guid.ToLower() == ((ComponentWrapper)RectNode.Tag).Guid.ToLower()) { EndNode = RectNode; } } } if ((StartNode != null) && (EndNode != null)) { switch (link.Type) { case HierarchyCollection.Link.LINK_TYPE.Dependency: AddLinkElement("Depend", StartNode, 4, LineCap.RoundAnchor, EndNode, 4, LineCap.ArrowAnchor, Color.Red, -10, -10); break; case HierarchyCollection.Link.LINK_TYPE.Realise: AddLinkElement("Realise", StartNode, 4, LineCap.RoundAnchor, EndNode, 4, LineCap.ArrowAnchor, Color.Blue, -10, -10); break; case HierarchyCollection.Link.LINK_TYPE.Stub: AddLinkElement("Stub", StartNode, 5, LineCap.RoundAnchor, EndNode, 5, LineCap.ArrowAnchor, Color.Black, 10, 10); break; case HierarchyCollection.Link.LINK_TYPE.Associate: AddLinkElement("Associate with", StartNode, 5, LineCap.RoundAnchor, EndNode, 5, LineCap.ArrowAnchor, Color.Green, 10, 10); break; } } else { } } }
private void containingFolderToolStripMenuItem_Click(object sender, EventArgs e) { if (designer1.Document.SelectedElements.Count == 1) { if (designer1.Document.SelectedElements[0].GetType() == typeof(MFRectangleNode)) { MFRectangleNode RectNode = (MFRectangleNode)designer1.Document.SelectedElements[0]; ComponentWrapper comp = (ComponentWrapper)RectNode.Tag; string path = string.Empty; switch (comp.ComponentType) { case ComponentTypeWrapper.Library: path = PK.Wrapper.FindLibrary(comp).ProjectPath; break; case ComponentTypeWrapper.Feature: path = PK.Wrapper.FindFeature(comp.Guid).ProjectPath; break; case ComponentTypeWrapper.MFAssembly: path = PK.Wrapper.FindAssembly(comp.Guid).ProjectPath; break; case ComponentTypeWrapper.MFSolution: path = comp.ProjectPath; break; case ComponentTypeWrapper.Processor: path = PK.Wrapper.FindProcessor(comp.Guid).ProjectPath; break; case ComponentTypeWrapper.OperatingSystem: path = comp.ProjectPath; break; case ComponentTypeWrapper.BuildTool: path = comp.ProjectPath; break; case ComponentTypeWrapper.ISA: path = PK.Wrapper.FindISA(comp.Guid).InnerProjectPath; break; case ComponentTypeWrapper.BuildParameter: path = comp.ProjectPath; break; case ComponentTypeWrapper.LibraryCategory: path = PK.Wrapper.FindLibraryCategory(comp.Guid).ProjectPath; break; default: path = comp.ProjectPath; break; } this.OnOpenContainingFolderEvent(path); } } }