Esempio n. 1
0
        public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel vm)
        {
            _model       = model;
            stateMachine = new StateMachine(this);

            //setup the composite collection
            var previewsColl = new CollectionContainer {
                Collection = Previews
            };

            _workspaceElements.Add(previewsColl);

            var nodesColl = new CollectionContainer {
                Collection = Nodes
            };

            _workspaceElements.Add(nodesColl);

            var connColl = new CollectionContainer {
                Collection = Connectors
            };

            _workspaceElements.Add(connColl);

            var notesColl = new CollectionContainer {
                Collection = Notes
            };

            _workspaceElements.Add(notesColl);

            var errorsColl = new CollectionContainer {
                Collection = Errors
            };

            _workspaceElements.Add(errorsColl);

            // Add EndlessGrid
            var endlessGrid = new EndlessGridViewModel(this);

            _workspaceElements.Add(endlessGrid);

            //respond to collection changes on the model by creating new view models
            //currently, view models are added for notes and nodes
            //connector view models are added during connection
            _model.Nodes.CollectionChanged      += Nodes_CollectionChanged;
            _model.Notes.CollectionChanged      += Notes_CollectionChanged;
            _model.Connectors.CollectionChanged += Connectors_CollectionChanged;
            _model.PropertyChanged += ModelPropertyChanged;

            DynamoSelection.Instance.Selection.CollectionChanged += this.AlignSelectionCanExecuteChanged;

            // sync collections
            Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Nodes));
            Connectors_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Connectors));
            Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Notes));
            Dispatcher = Dispatcher.CurrentDispatcher;
        }
Esempio n. 2
0
        public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel)
        {
            this.DynamoViewModel = dynamoViewModel;

            Model        = model;
            stateMachine = new StateMachine(this);

            var nodesColl = new CollectionContainer {
                Collection = Nodes
            };

            _workspaceElements.Add(nodesColl);

            var connColl = new CollectionContainer {
                Collection = Connectors
            };

            _workspaceElements.Add(connColl);

            var notesColl = new CollectionContainer {
                Collection = Notes
            };

            _workspaceElements.Add(notesColl);

            var errorsColl = new CollectionContainer {
                Collection = Errors
            };

            _workspaceElements.Add(errorsColl);

            // Add EndlessGrid
            var endlessGrid = new EndlessGridViewModel(this);

            _workspaceElements.Add(endlessGrid);

            //respond to collection changes on the model by creating new view models
            //currently, view models are added for notes and nodes
            //connector view models are added during connection
            Model.Nodes.CollectionChanged += Nodes_CollectionChanged;
            Model.Notes.CollectionChanged += Notes_CollectionChanged;
            Model.ConnectorAdded          += Connectors_ConnectorAdded;
            Model.ConnectorDeleted        += Connectors_ConnectorDeleted;
            Model.PropertyChanged         += ModelPropertyChanged;

            DynamoSelection.Instance.Selection.CollectionChanged += this.AlignSelectionCanExecuteChanged;

            // sync collections
            Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Nodes));
            Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Notes));
            foreach (var c in Model.Connectors)
            {
                Connectors_ConnectorAdded(c);
            }
        }
Esempio n. 3
0
        public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel)
        {
            this.DynamoViewModel = dynamoViewModel;

            Model = model;
            stateMachine = new StateMachine(this);

            var nodesColl = new CollectionContainer { Collection = Nodes };
            _workspaceElements.Add(nodesColl);

            var connColl = new CollectionContainer { Collection = Connectors };
            _workspaceElements.Add(connColl);

            var notesColl = new CollectionContainer { Collection = Notes };
            _workspaceElements.Add(notesColl);

            var errorsColl = new CollectionContainer { Collection = Errors };
            _workspaceElements.Add(errorsColl);

            // Add EndlessGrid
            var endlessGrid = new EndlessGridViewModel(this);
            _workspaceElements.Add(endlessGrid);

            //respond to collection changes on the model by creating new view models
            //currently, view models are added for notes and nodes
            //connector view models are added during connection
            Model.Nodes.CollectionChanged += Nodes_CollectionChanged;
            Model.Notes.CollectionChanged += Notes_CollectionChanged;
            Model.Connectors.CollectionChanged += Connectors_CollectionChanged;
            Model.PropertyChanged += ModelPropertyChanged;

            DynamoSelection.Instance.Selection.CollectionChanged += this.AlignSelectionCanExecuteChanged;

            // sync collections
            Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Nodes));
            Connectors_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Connectors));
            Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Notes));
        }
        public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel vm)
        {
            _model = model;
            stateMachine = new StateMachine(this);

            //setup the composite collection
            var previewsColl = new CollectionContainer { Collection = Previews };
            _workspaceElements.Add(previewsColl);

            var nodesColl = new CollectionContainer { Collection = Nodes };
            _workspaceElements.Add(nodesColl);

            var connColl = new CollectionContainer { Collection = Connectors };
            _workspaceElements.Add(connColl);

            var notesColl = new CollectionContainer { Collection = Notes };
            _workspaceElements.Add(notesColl);

            var errorsColl = new CollectionContainer { Collection = Errors };
            _workspaceElements.Add(errorsColl);

            // Add EndlessGrid
            var endlessGrid = new EndlessGridViewModel(this);
            _workspaceElements.Add(endlessGrid);

            //respond to collection changes on the model by creating new view models
            //currently, view models are added for notes and nodes
            //connector view models are added during connection
            _model.Nodes.CollectionChanged += Nodes_CollectionChanged;
            _model.Notes.CollectionChanged += Notes_CollectionChanged;
            _model.Connectors.CollectionChanged += Connectors_CollectionChanged;
            _model.PropertyChanged += ModelPropertyChanged;

            // sync collections
            Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Nodes));
            Connectors_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Connectors));
            Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Notes));
            Dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
        }
Esempio n. 5
0
        public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel)
        {
            this.DynamoViewModel = dynamoViewModel;
            this.DynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged;

            Model = model;
            stateMachine = new StateMachine(this);

            var nodesColl = new CollectionContainer { Collection = Nodes };
            _workspaceElements.Add(nodesColl);

            var connColl = new CollectionContainer { Collection = Connectors };
            _workspaceElements.Add(connColl);

            var notesColl = new CollectionContainer { Collection = Notes };
            _workspaceElements.Add(notesColl);

            var errorsColl = new CollectionContainer { Collection = Errors };
            _workspaceElements.Add(errorsColl);

            var annotationsColl = new CollectionContainer {Collection = Annotations};
            _workspaceElements.Add(annotationsColl);
            // Add EndlessGrid
            var endlessGrid = new EndlessGridViewModel(this);
            _workspaceElements.Add(endlessGrid);

            //respond to collection changes on the model by creating new view models
            //currently, view models are added for notes and nodes
            //connector view models are added during connection
            Model.Nodes.CollectionChanged += Nodes_CollectionChanged;
            Model.Notes.CollectionChanged += Notes_CollectionChanged;
            Model.Annotations.CollectionChanged +=Annotations_CollectionChanged;
            Model.ConnectorAdded += Connectors_ConnectorAdded;
            Model.ConnectorDeleted += Connectors_ConnectorDeleted;
            Model.PropertyChanged += ModelPropertyChanged;

            DynamoSelection.Instance.Selection.CollectionChanged += 
                (sender, e) => RefreshViewOnSelectionChange();

            // sync collections
            Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Nodes));
            Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Notes));
            Annotations_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Annotations));
            foreach (var c in Model.Connectors)
                Connectors_ConnectorAdded(c);

            InCanvasSearchViewModel = new SearchViewModel(DynamoViewModel);
            InCanvasSearchViewModel.Visible = true;
        }
Esempio n. 6
0
        public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel)
        {
            this.DynamoViewModel = dynamoViewModel;
            this.DynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged;

            Model        = model;
            stateMachine = new StateMachine(this);

            var nodesColl = new CollectionContainer {
                Collection = Nodes
            };

            _workspaceElements.Add(nodesColl);

            var connColl = new CollectionContainer {
                Collection = Connectors
            };

            _workspaceElements.Add(connColl);

            var notesColl = new CollectionContainer {
                Collection = Notes
            };

            _workspaceElements.Add(notesColl);

            var errorsColl = new CollectionContainer {
                Collection = Errors
            };

            _workspaceElements.Add(errorsColl);

            var annotationsColl = new CollectionContainer {
                Collection = Annotations
            };

            _workspaceElements.Add(annotationsColl);
            // Add EndlessGrid
            var endlessGrid = new EndlessGridViewModel(this);

            _workspaceElements.Add(endlessGrid);

            //respond to collection changes on the model by creating new view models
            //currently, view models are added for notes and nodes
            //connector view models are added during connection

            Model.NodeAdded    += Model_NodeAdded;
            Model.NodeRemoved  += Model_NodeRemoved;
            Model.NodesCleared += Model_NodesCleared;

            Model.Notes.CollectionChanged       += Notes_CollectionChanged;
            Model.Annotations.CollectionChanged += Annotations_CollectionChanged;
            Model.ConnectorAdded   += Connectors_ConnectorAdded;
            Model.ConnectorDeleted += Connectors_ConnectorDeleted;
            Model.PropertyChanged  += ModelPropertyChanged;

            DynamoSelection.Instance.Selection.CollectionChanged +=
                (sender, e) => RefreshViewOnSelectionChange();

            // sync collections


            foreach (NodeModel node in Model.Nodes)
            {
                Model_NodeAdded(node);
            }
            Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Notes));
            Annotations_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Annotations));
            foreach (var c in Model.Connectors)
            {
                Connectors_ConnectorAdded(c);
            }

            InCanvasSearchViewModel         = new SearchViewModel(DynamoViewModel);
            InCanvasSearchViewModel.Visible = true;
        }