public PropertyNode(Core.VplControl hostCanvas): base(hostCanvas)
        { 
            DataContext = this;

            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            // Ports 
            AddInputPortToNode("Element", typeof(object));
            AddOutputPortToNode("Property", typeof(object));

            // Init the Control 
            _control = new PropertyNodeControl
            {
                DataContext = this
            };

            AddControlToNode(_control);
            // EventHandlers 
            _control.ElementTypeListBox.SelectionChanged += ElementTypeListBoxOnSelectionChanged;
            _control.AttributeGroupListBox.SelectionChanged += AttributeGroupListBoxOnSelectionChanged;
            _control.AttributesListBox.SelectionChanged += AttributesListBoxOnSelectionChanged;

            _control.FilterTextBox.SelectionChanged += FilterTextBoxOnSelectionChanged;
        }
        public WebProjectSelectionNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            DataContext = this;

            AddOutputPortToNode("Project", typeof(object));
            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            IsResizeable = true;

            var webControl = new ProjectSelection(_controller.IntBase);
            {
                Visibility = Visibility.Visible;
            };

            // webControl.ProjectChangedEventHandler += ProjectSelectionViewModelOnProjectChangedEventHandler;
            // webControl.TeamChangedEventHandler += ProjectSelectionViewModelOnTeamChangedEventHandler;

            var pr = new ContentPresenter
            {
                Content = webControl,
                MinWidth = 600,
                MinHeight = 600
            };

            AddControlToNode(pr);
        }
        public ElementTypeNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            DataContext = this;

            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;


            AddOutputPortToNode("ElementType", typeof (object));

            _typeComboBox = new ComboBox
            {
                DisplayMemberPath = "Name",
                Margin = new Thickness(5, 20, 5, 15)
            };
            _typeComboBox.SelectionChanged += SelectionChanged;

            if (_controller.IntBase.APICore != null)
            {
                _typeComboBox.ItemsSource = _controller.IntBase.APICore.DtObjects.GetElementTypes();
            }
            AddControlToNode(_typeComboBox);

            QuestButton.Visibility = Visibility.Visible;
            BinButton.Visibility = Visibility.Visible;

            // TopComment.Visibility = Visibility.Visible;
            // BottomComment.Visibility = Visibility.Visible;
        }
        public ProjectNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            DataContext = this;

            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            _controller.IntBase.EventHandlerCore.TeamChanged += EventHandlerCoreOnTeamChanged;

            if (_controller.IntBase != null)
            {
                _projectComboBox = new ComboBox
                {
                    ItemsSource = _controller.IntBase.APICore.Projects.GetShortProjects(),
                    Width = 100,
                    SelectedItem = _selectedProject,
                    DisplayMemberPath = "Name",
                    Margin = new Thickness(5, 20, 5, 15)
                };

                // Add EventHandler
                _projectComboBox.SelectionChanged += SelectionChanged;

                if (_controller.IntBase != null)
                    AddControlToNode(_projectComboBox);
                else
                    AddControlToNode(new TextBox {Text = "No Connection"});
            }

            AddOutputPortToNode("Project", typeof (object));
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public ModelInfo(string projectId, string modelId, List<Guid> elementIds, ModelType modelType)
        {
            ProjectId = projectId;
            ModelId = modelId;
            ElementIds = elementIds;
            ModelType = modelType;

            _controller = DataController.Instance;
        }
        public override void Calculate()
        {
            _controller = DataController.Instance;

            if (_controller.IntBase != null)
            {
                OutputPorts[0].Data = _controller.IntBase;
            }
        }
        public IssueContainerNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            AddInputPortToNode("Project", typeof(object));
            AddOutputPortToNode("Issues", typeof(object));
            DataContext = this;
        }
        public BimPlusWatch3DNode(Core.VplControl hostCanvas): base(hostCanvas)
        {
            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            HelixViewport3D.Title = "BimPlus Viewer";

            // Refresh the selected Models
            SelectedModels = new List<GeometryModel3D>();
        }
        public ElementMergeNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            var lbl = new Label{Content = "Filter Node ", Margin = new Thickness(5,15, 5, 10)};
            AddInputPortToNode("Input", typeof (object));
            AddInputPortToNode("Input", typeof(object));

            AddOutputPortToNode("MergedElements", typeof(object));

            // LabelCaption.Visibility = Visibility.Visible;
            // LabelCaption.Content = "";
            DataContext = this;
        }
        public StructureFilterNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            _control = new StructureFilterNodeControl();

            AddControlToNode(_control);

            AddInputPortToNode("Input", typeof (object));

            AddOutputPortToNode("FilteredElements", typeof(object));

            DataContext = this;
        }
        public ElementContainerNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            _control = new ElementContainerNodeControl();
            _control.cancelBut.Click += CancelButOnClick;

            AddControlToNode(_control);

            //Input
            AddInputPortToNode("Input", typeof (object));
            // Output
            AddOutputPortToNode("Elements", typeof (ModelInfo));

            DataContext = this;
        }
        // private List<BaseElement> _elements;

        public IssueNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            _issueControl = new IssueNodeControl();
            _issueControl.BaseButtonClicked += IssueControlOnBaseButtonClicked;

            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            AddInputPortToNode("Project/Model", typeof (object));
            AddInputPortToNode("LinkedElements", typeof (object));
            AddInputPortToNode("GeometryView", typeof (object));

            // Is this correct? There can be different members in different projects ...
            // _controller.IntBase.APICore.GetTea
            _issueControl.ResponsibleUserComboBox.ItemsSource = _controller.IntBase.APICore.Projects.GetMembers(_controller.IntBase.CurrentProject.Id);
            _issueControl.ResponsibleUserComboBox.DisplayMemberPath = "User";

            AddControlToNode(_issueControl);
            DataContext = this;
        }
        public ElementFilterNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            // Add ComboBox to the control ... 
            _filterListBox = new ListBox()
            {
                MaxHeight = 200,
                MinWidth = 100,
                SelectionMode = SelectionMode.Multiple
            };

            _filterListBox.SelectionChanged += FilterListBoxOnSelectionChanged;
            AddControlToNode(_filterListBox);

            AddInputPortToNode("Input", typeof (ModelInfo));
            AddOutputPortToNode("FilteredElements", typeof(ModelInfo));

            DataContext = this;
        }
        public ModelNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            DataContext = this;

            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            AddInputPortToNode("Project", typeof(object));
            AddOutputPortToNode("Model", typeof(object));

            _modelComboBox = new ComboBox
            {
                DisplayMemberPath = "Name",
                Width = 100,
                Margin = new Thickness(5,20,5,15)
            };
            _modelComboBox.SelectionChanged += SelectionChanged;

            AddControlToNode(_modelComboBox);

            BinButton.Visibility = Visibility.Visible;
        }
        public GeometryOperationNode(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            DataContext = this;

            // Call the Singleton Class to get the actual loaded elements -> Connection to the DataModel
            _controller = DataController.Instance;

            // Init the QL4BIM framework
            ql4Spatial.InitializeSettings();

            // Input
            AddInputPortToNode("InputElements_1", typeof(List<DtObject>));
            // Input
            AddInputPortToNode("InputElements_2", typeof(List<DtObject>));
            // Output
            AddOutputPortToNode("Relation", typeof(Relation));

            // Control
            _typeComboBox = new ComboBox();
            _typeComboBox.Items.Add("Overlap");
            _typeComboBox.Items.Add("Touch");
            _typeComboBox.Items.Add("Contain");
            _typeComboBox.Items.Add("AboveOf");
            _typeComboBox.Items.Add("BelowOf");
            _typeComboBox.Items.Add("WestOf");
            _typeComboBox.Items.Add("EastOf");
            _typeComboBox.Items.Add("NorthOf");
            _typeComboBox.Items.Add("SouthOf");
            _typeComboBox.SelectedItem = _typeComboBox.Items.GetItemAt(0);
            AddControlToNode(_typeComboBox);

            _button = new Button {Content = "Execute"};
            _button.Click += ButtonOnClick;
            AddControlToNode(_button);

        }
        public void Login()
        {
            string fileName = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) +
                @"\Nemetschek\bim+\IntegrationBase.Log";
            FileStream fileStream = new FileStream(fileName, FileMode.Append);

            _streamWriter = new StreamWriter(fileStream);

            _dataController = DataController.Instance;
            _dataController.IntBase = new IntegrationBase(_streamWriter);

            // Init the data controller instance ... 
            ILoginWindow loginWindow = new DefaultLogin();

            if (_dataController.IntBase.ConnectWithLoginDialog(loginWindow))
            {
                Guid projectId = Guid.Empty;

                // Init the eventHandlers
                if (_dataController.IntBase.Connection != null && _dataController.IntBase.Connection.AccessToken() != Guid.Empty)
                {
                    _dataController.IntBase.EventHandlerCore.ProjectChanged += EventHandlerCoreOnProjectChanged;
                    _dataController.IntBase.EventHandlerCore.TeamChanged += EventHandlerCoreOnTeamChanged;
                }
            }

            // Choose the first default Team
            _dataController.IntBase.CurrentTeam = _dataController.IntBase.GetTeams().FirstOrDefault();

            // Update UI
            if (Application.Current != null)
                Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(
                    () =>
                    {
                        CurrentUserLabel.Content = _dataController.IntBase.UserName.ToString();
                    }));
        }