/// <summary> /// Constructor /// </summary> public MainWindow() { InitializeComponent(); // Init the VPlControl // Add Ports VplControl.MainVplControl.NodeCollection.CollectionChanged += NodeCollectionOnCollectionChanged; // IFC VplControl.InputPortArea.AddNamespaceToPortSelection("TUM.CMS.VplControl.IFC.Ports.Input", Assembly.GetAssembly(typeof(IfcProjectPort))); VplControl.InputPortArea.AddNamespaceToPortSelection("TUM.CMS.VplControl.VCCL.Ports.Input", Assembly.GetAssembly(typeof(TrueFalsePort))); VplControl.OutputPortArea.AddNamespaceToPortSelection("TUM.CMS.VplControl.IFC.Ports.Output", Assembly.GetAssembly(typeof(IfcProjectOutputPort))); // BIMPLUS // VplControl.OutputPortArea.AddNamespaceToPortSelection("TUM.CMS.VplControl.BimPlus.Ports.Output", Assembly.GetAssembly(typeof(BimPlusViewerPort))); // VplControl.InputPortArea.AddNamespaceToPortSelection("TUM.CMS.VplControl.BimPlus.Ports.Input", Assembly.GetAssembly(typeof(BimPlusProjectPort))); // Add NodeTypes VplControl.MainVplControl.ExternalNodeTypes.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(ComposedNode)), "TUM.CMS.ExtendedVplControl.Nodes") .ToList()); // VplControl.MainVplControl.ExternalNodeTypes.AddRange( // ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(Watch3DNode)), "TUM.CMS.VplControl.Watch3D.Nodes") // .ToList()); // VplControl.MainVplControl.ExternalNodeTypes.AddRange( // ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(ProjectNode)), "TUM.CMS.VplControl.BimPlus.Nodes") // .ToList()); // VplControl.MainVplControl.ExternalNodeTypes.AddRange( // ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(ScriptingNode)), "TUM.CMS.VPL.Scripting.Nodes") // .ToList()); // VplControl.MainVplControl.ExternalNodeTypes.AddRange( // ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(Watch3DxNode)), "TUM.CMS.VplControl.Watch3Dx.Nodes") // .ToList()); VplControl.MainVplControl.ExternalNodeTypes.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(JoinNode)), "TUM.CMS.VplControl.Relations.Nodes") .ToList()); VplControl.MainVplControl.ExternalNodeTypes.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(IfcViewerNode)), "TUM.CMS.VplControl.IFC.Nodes") .ToList()); VplControl.MainVplControl.NodeTypeMode = NodeTypeModes.All; // Turn off Sensitivity VplControl.MainVplControl.TypeSensitive = false; // Connect the UI event handlers KeyDown += VplControl.MainVplControl.VplControl_KeyDown; KeyUp += VplControl.MainVplControl.VplControl_KeyUp; // Init the ModelController modelController = ModelController.Instance; }
public SelectionNode(VplControl hostCanvas) : base(hostCanvas) { searchTextBox = new SearchTextBox(); searchTextBox.OnSearch += searchTextBox_OnSearch; var tempTypeList = new List <Type>(); AddControlToNode(searchTextBox); listBox.DisplayMemberPath = "Name"; listBox.MaxHeight = 140; // Mine listBox.MinWidth = 150; AddControlToNode(listBox); switch (hostCanvas.NodeTypeMode) { case NodeTypeModes.OnlyInternalTypes: tempTypeList.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes") .ToList()); break; case NodeTypeModes.OnlyExternalTypes: tempTypeList.AddRange(hostCanvas.ExternalNodeTypes); break; case NodeTypeModes.All: tempTypeList.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes") .ToList()); tempTypeList.AddRange(hostCanvas.ExternalNodeTypes); break; } tempTypeList = tempTypeList.OrderBy(x => x.Name).ToList(); foreach ( var type in tempTypeList.Where( type => !type.IsAbstract && !type.IsDefined(typeof(CompilerGeneratedAttribute), true))) { typeList.Add(type); } listBox.ItemsSource = typeList; searchTextBox.PreviewKeyDown += searchTextBox_KeyDown; listBox.PreviewMouseLeftButtonUp += listBox_PreviewMouseLeftButtonUp; listBox.SelectionMode = SelectionMode.Single; Border.MouseLeave += SelectionNode_MouseLeave; MouseEnter += SelectionNode_MouseEnter; }
public MainWindow() { InitializeComponent(); KeyDown += VplControl.VplControl_KeyDown; KeyUp += VplControl.VplControl_KeyUp; VplControl.ExternalNodeTypes.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Test.Nodes") .ToList()); VplControl.ExternalNodeTypes.Add(typeof(ScriptingNode)); VplControl.NodeTypeMode = NodeTypeModes.All; //VplPropertyGrid.SelectedObject = VplControl; }
public MainWindow() { InitializeComponent(); KeyDown += VplControl.VplControl_KeyDown; KeyUp += VplControl.VplControl_KeyUp; VplControl.ExternalNodeTypes.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Test.Nodes") .ToList()); VplControl.ExternalNodeTypes.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(Watch3DNode)), "TUM.CMS.VplControl.Watch3D.Nodes") .ToList()); VplControl.ExternalNodeTypes.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(EnergyCalculatorNode)), "TUM.CMS.VplControl.Energy.Nodes") .ToList()); VplControl.ExternalNodeTypes.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetAssembly(typeof(IfcMapsNode)), "TUM.CMS.VplControl.IFC.Nodes") .ToList()); VplControl.ExternalNodeTypes.Add(typeof(ScriptingNode)); // VplControl.ExternalNodeTypes.Add(typeof(Watch3DNode)); VplControl.NodeTypeMode = NodeTypeModes.All; //VplControl.NodeTypeMode = NodeTypeModes.OnlyInternalTypes; VplControl.NodesFilterted = false; var groupNamespaces = VplControl.ExternalNodeTypes.GroupBy(u => u.Namespace).Select(grp => grp.ToList()).ToList(); Separator separator = new Separator(); Nodes.Items.Add(separator); foreach (var namespaceItem in groupNamespaces) { var namespaceNameList = namespaceItem[0].Namespace.Split('.'); var namespaceName = namespaceNameList[3]; if (namespaceNameList[3] == "") { namespaceName = namespaceNameList[2]; } MenuItem namespaceMenuItem = new MenuItem(); namespaceMenuItem.Header = namespaceName; namespaceMenuItem.Name = namespaceName; Nodes.Items.Add(namespaceMenuItem); foreach (var item in namespaceItem) { if (!item.Name.Contains("<")) { MenuItem tempItem1 = new MenuItem(); tempItem1.Header = item.Name; tempItem1.Click += NodeItem_Click; namespaceMenuItem.Items.Add(tempItem1); } } } foreach (var namespaceItem in groupNamespaces) { var namespaceNameList = namespaceItem[0].Namespace.Split('.'); var namespaceName = namespaceNameList[3]; if (namespaceNameList[3] == "") { namespaceName = namespaceNameList[2]; } MenuItem namespaceMenuItem = new MenuItem(); namespaceMenuItem.Header = namespaceName; namespaceMenuItem.Click += ChangeNodesFilter_Click; SelectShownNodes.Items.Add(namespaceMenuItem); } Separator separator1 = new Separator(); SelectShownNodes.Items.Add(separator1); MenuItem namespaceMenuItem1 = new MenuItem(); namespaceMenuItem1.Header = "All"; namespaceMenuItem1.Click += ChangeNodesFilter_Click; SelectShownNodes.Items.Add(namespaceMenuItem1); string dirPath = Directory.GetParent(Directory.GetCurrentDirectory()) + "\\Templates\\"; string[] files = Directory.GetFiles(dirPath); foreach (var file in files) { FileInfo info = new FileInfo(file); FileAttributes attributes = info.Attributes; if (info.Extension.ToUpper() == ".VPLXML") { MenuItem menuItem = new MenuItem(); menuItem.Header = Path.GetFileNameWithoutExtension(info.Name); menuItem.Click += OpenTemplateNode; NodesTemplate.Items.Add(menuItem); } } }
public SelectionNode(VplControl hostCanvas) : base(hostCanvas) { searchTextBox = new SearchTextBox(); searchTextBox.OnSearch += searchTextBox_OnSearch; var tempTypeList = new List <Type>(); AddControlToNode(searchTextBox); listBox.DisplayMemberPath = "Name"; listBox.MaxHeight = 140; AddControlToNode(listBox); if (hostCanvas.NodesFilterted) { foreach (var item in hostCanvas.ExternalNodeTypes) { if (item.Namespace.Contains(hostCanvas.NodesFilterName)) { tempTypeList.Add(item); } } } else { switch (hostCanvas.NodeTypeMode) { case NodeTypeModes.OnlyInternalTypes: tempTypeList.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes") .ToList()); break; case NodeTypeModes.OnlyExternalTypes: tempTypeList.AddRange(hostCanvas.ExternalNodeTypes); break; case NodeTypeModes.All: tempTypeList.AddRange( ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Nodes") .ToList()); tempTypeList.AddRange(hostCanvas.ExternalNodeTypes); break; } } tempTypeList = tempTypeList.OrderBy(x => x.Name).ToList(); foreach (var type in tempTypeList.Where(type => !type.IsAbstract)) { if (type.Name.Contains('<') || type.Name.Contains("ComboboxItem")) { } else { typeList.Add(type); } } listBox.ItemsSource = typeList; searchTextBox.PreviewKeyDown += searchTextBox_KeyDown; listBox.PreviewMouseLeftButtonUp += listBox_PreviewMouseLeftButtonUp; listBox.SelectionMode = SelectionMode.Single; Border.MouseLeave += SelectionNode_MouseLeave; MouseEnter += SelectionNode_MouseEnter; }