예제 #1
0
        public dynWorkspaceViewModel(dynWorkspaceModel model, DynamoViewModel vm)
        {
            _model = model;

            this.CurrentOffset = new Point(10,10);

            var nodesColl = new CollectionContainer();
            nodesColl.Collection = Nodes;
            WorkspaceElements.Add(nodesColl);

            var connColl = new CollectionContainer();
            connColl.Collection = Connectors;
            WorkspaceElements.Add(connColl);

            var notesColl = new CollectionContainer();
            notesColl.Collection = Notes;
            WorkspaceElements.Add(notesColl);

            //var watch3DColl = new CollectionContainer();
            //watch3DColl.Collection = Watch3DViewModels;
            //WorkspaceElements.Add(watch3DColl);

            Watch3DViewModels.Add(new Watch3DFullscreenViewModel(this));

            //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;

            HideCommand = new DelegateCommand<object>(Hide, CanHide);
            CrossSelectCommand = new DelegateCommand<object>(CrossingSelect, CanCrossSelect);
            ContainSelectCommand = new DelegateCommand<object>(ContainSelect, CanContainSelect);
            SetCurrentOffsetCommand = new DelegateCommand<object>(SetCurrentOffset, CanSetCurrentOffset);
            NodeFromSelectionCommand = new DelegateCommand(CreateNodeFromSelection, CanCreateNodeFromSelection);
            SetZoomCommand = new DelegateCommand<object>(SetZoom, CanSetZoom);

            DynamoSelection.Instance.Selection.CollectionChanged += NodeFromSelectionCanExecuteChanged;

            // 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));
        }
예제 #2
0
        public dynWorkspaceViewModel(dynWorkspaceModel model, DynamoViewModel vm)
        {
            _model = model;

            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);

            //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;

            HideCommand = new DelegateCommand<object>(Hide, CanHide);
            CrossSelectCommand = new DelegateCommand<object>(CrossingSelect, CanCrossSelect);
            ContainSelectCommand = new DelegateCommand<object>(ContainSelect, CanContainSelect);
            SetCurrentOffsetCommand = new DelegateCommand<object>(SetCurrentOffset, CanSetCurrentOffset);
            NodeFromSelectionCommand = new DelegateCommand(CreateNodeFromSelection, CanCreateNodeFromSelection);
            SetZoomCommand = new DelegateCommand<object>(SetZoom, CanSetZoom);
            FindByIdCommand = new DelegateCommand<object>(FindById, CanFindById);
            AlignSelectedCommand = new DelegateCommand<string>(AlignSelected, CanAlignSelected);
            SelectAllCommand = new DelegateCommand(SelectAll, CanSelectAll);
            FindNodesFromSelectionCommand = new DelegateCommand(FindNodesFromSelection, CanFindNodesFromSelection);

            DynamoSelection.Instance.Selection.CollectionChanged += NodeFromSelectionCanExecuteChanged;

            // 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));
        }
예제 #3
0
 public dynNodeModel NodeFromCurrentSpace(DynamoViewModel vm, Guid guid)
 {
     return vm.CurrentSpace.Nodes.FirstOrDefault((node) => node.GUID == guid);
 }
예제 #4
0
 public dynNodeModel NodeFromCurrentSpace(DynamoViewModel vm, string guidString)
 {
     Guid guid = Guid.Empty;
     Guid.TryParse(guidString, out guid);
     return NodeFromCurrentSpace(vm, guid);
 }
예제 #5
0
 public dynWatch GetWatchNodeFromCurrentSpace(DynamoViewModel vm, string guidString)
 {
     var nodeToWatch = NodeFromCurrentSpace(vm, guidString);
     Assert.NotNull(nodeToWatch);
     Assert.IsAssignableFrom(typeof(dynWatch), nodeToWatch);
     return (dynWatch)nodeToWatch;
 }
예제 #6
0
        private void dynBench_Activated(object sender, EventArgs e)
        {
            this.WorkspaceTabs.SelectedIndex = 0;
            _vm = (DataContext as DynamoViewModel);
            _vm.RequestLayoutUpdate += vm_RequestLayoutUpdate;
            _vm.PostUIActivationCommand.Execute();

            _timer.Stop();
            dynSettings.Controller.DynamoViewModel.Log(string.Format("{0} elapsed for loading Dynamo main window.",
                                                                     _timer.Elapsed));
        }
예제 #7
0
 public void Init()
 {
     StartDynamo();
     _vm = dynSettings.Controller.DynamoViewModel;
 }
예제 #8
0
 void dynBench_Activated(object sender, EventArgs e)
 {
     this.WorkspaceTabs.SelectedIndex = 0;
     _vm = (DataContext as DynamoViewModel);
     _vm.RequestLayoutUpdate += vm_RequestLayoutUpdate;
     _vm.PostUIActivationCommand.Execute();
 }