Пример #1
0
 public NoteViewModel(WorkspaceViewModel workspaceViewModel, NoteModel model)
 {
     this.WorkspaceViewModel = workspaceViewModel;
     _model = model;
     model.PropertyChanged += note_PropertyChanged;
     DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;
 }
Пример #2
0
        public NodeViewModel(WorkspaceViewModel workspaceViewModel, NodeModel logic)
        {
            WorkspaceViewModel = workspaceViewModel;
            DynamoViewModel = workspaceViewModel.DynamoViewModel;
           
            nodeLogic = logic;
            
            //respond to collection changed events to add
            //and remove port model views
            logic.InPorts.CollectionChanged += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;

            DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            DynamoViewModel.Model.DebugSettings.PropertyChanged += DebugSettings_PropertyChanged;

            ErrorBubble = new InfoBubbleViewModel(DynamoViewModel);
            UpdateBubbleContent();

            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            if (IsDebugBuild)
            {
                DynamoViewModel.EngineController.AstBuilt += EngineController_AstBuilt;
            }

            ShowExecutionPreview = workspaceViewModel.DynamoViewModel.ShowRunPreview;
            IsNodeAddedRecently = true;
            DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;             
        }
Пример #3
0
 public Watch3DFullscreenViewModel(WorkspaceViewModel parentWorkspace)
 {
     ParentWorkspace = parentWorkspace;
 }
Пример #4
0
 internal StateMachine(WorkspaceViewModel owningWorkspace)
 {
     this.owningWorkspace = owningWorkspace;
 }
Пример #5
0
        /// <summary>
        /// Construct a view and respond to property changes on the model. 
        /// </summary>
        /// <param name="model"></param>
        public ConnectorViewModel(WorkspaceViewModel workspace, ConnectorModel model)
        {
            this.workspaceViewModel = workspace;
            _model = model;

            _model.PropertyChanged += Model_PropertyChanged;
            _model.Start.Owner.PropertyChanged += StartOwner_PropertyChanged;
            _model.End.Owner.PropertyChanged += EndOwner_PropertyChanged;

            workspaceViewModel.DynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged;

            Redraw();
        }
Пример #6
0
 public NoteViewModel(WorkspaceViewModel workspaceViewModel, NoteModel model)
 {
     this.WorkspaceViewModel = workspaceViewModel;
     _model = model;
     model.PropertyChanged += note_PropertyChanged;
 }
Пример #7
0
 private void WorkspaceRemoved(WorkspaceModel item)
 {
     var viewModel = workspaces.First(x => x.Model == item);
     if (currentWorkspaceViewModel == viewModel)
         currentWorkspaceViewModel = null;
     workspaces.Remove(viewModel);
 }
Пример #8
0
        public NodeViewModel(WorkspaceViewModel workspaceViewModel, NodeModel logic)
        {
            this.WorkspaceViewModel = workspaceViewModel;
            this.DynamoViewModel = workspaceViewModel.DynamoViewModel;

            nodeLogic = logic;

            //respond to collection changed events to sadd
            //and remove port model views
            logic.InPorts.CollectionChanged += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;

            this.DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            this.DynamoViewModel.Model.DebugSettings.PropertyChanged += DebugSettings_PropertyChanged;

            ErrorBubble = new InfoBubbleViewModel(this.DynamoViewModel);

            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            if (IsDebugBuild)
            {
                DynamoViewModel.Model.EngineController.AstBuilt += EngineController_AstBuilt;
            }
        }
Пример #9
0
        protected DynamoViewModel(StartConfiguration startConfiguration)
        {
            this.ShowLogin = startConfiguration.ShowLogin;

            // initialize core data structures
            this.model = startConfiguration.DynamoModel;
            this.model.CommandStarting += OnModelCommandStarting;
            this.model.CommandCompleted += OnModelCommandCompleted;

            UsageReportingManager.Instance.InitializeCore(this);
            this.WatchHandler = startConfiguration.WatchHandler;
            var pmExtension = model.GetPackageManagerExtension();
            this.PackageManagerClientViewModel = new PackageManagerClientViewModel(this, pmExtension.PackageManagerClient);
            this.SearchViewModel = new SearchViewModel(this);

            // Start page should not show up during test mode.
            this.ShowStartPage = !DynamoModel.IsTestMode;

            this.BrandingResourceProvider = startConfiguration.BrandingResourceProvider ?? new DefaultBrandingResourceProvider();

            //add the initial workspace and register for future 
            //updates to the workspaces collection
            var homespaceViewModel = new HomeWorkspaceViewModel(model.CurrentWorkspace as HomeWorkspaceModel, this);
            workspaces.Add(homespaceViewModel);
            currentWorkspaceViewModel = homespaceViewModel;

            model.WorkspaceAdded += WorkspaceAdded;
            model.WorkspaceRemoved += WorkspaceRemoved;

            SubscribeModelCleaningUpEvent();
            SubscribeModelUiEvents();
            SubscribeModelChangedHandlers();
            SubscribeUpdateManagerHandlers();

            InitializeAutomationSettings(startConfiguration.CommandFilePath);

            InitializeDelegateCommands();

            SubscribeLoggerHandlers();

            DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;

            InitializeRecentFiles();

            UsageReportingManager.Instance.PropertyChanged += CollectInfoManager_PropertyChanged;

            WatchIsResizable = false;

            SubscribeDispatcherHandlers();

            RenderPackageFactoryViewModel = new RenderPackageFactoryViewModel(Model.PreferenceSettings);
            RenderPackageFactoryViewModel.PropertyChanged += RenderPackageFactoryViewModel_PropertyChanged;
            
            var backgroundPreviewParams = new Watch3DViewModelStartupParams(Model, this, Resources.BackgroundPreviewName);

            // TODO: http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-8736
            Watch3DViewModelBase watch3DViewModel;
            try
            {
                watch3DViewModel = HelixWatch3DViewModel.Start(backgroundPreviewParams);
            }
            catch (Exception ex)
            {
                Model.Logger.Log(ex.Message);
                Model.Logger.Log("Failed to create Watch3DViewModel. Creating base view model.");

                watch3DViewModel = Watch3DViewModelBase.Start(backgroundPreviewParams);
            }

            BackgroundPreviewViewModel = watch3DViewModel;
            Watch3DViewModels.Add(watch3DViewModel);
            watch3DViewModel.PropertyChanged += Watch3DViewModelPropertyChanged;
        }
Пример #10
0
 public EndlessGridViewModel(WorkspaceViewModel workspaceVM)
 {
     this.workspaceVM = workspaceVM;
 }
Пример #11
0
 public NodeViewModel(WorkspaceViewModel workspaceViewModel, NodeModel logic, Size preferredSize)
     : this(workspaceViewModel, logic)
 {
     // preferredSize is set when a node needs to have a fixed size
     PreferredSize = preferredSize;
 }
Пример #12
0
 public EndlessGridViewModel(WorkspaceViewModel workspaceVM)
 {
     this.workspaceVM = workspaceVM;
 }
Пример #13
0
 public NoteViewModel(WorkspaceViewModel workspaceViewModel, NoteModel model)
 {
     this.WorkspaceViewModel = workspaceViewModel;
     _model = model;
     model.PropertyChanged += note_PropertyChanged;
     DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;
     ZIndex = ++StaticZIndex; // places the note on top of all nodes/notes
 }
Пример #14
0
 public Watch3DFullscreenViewModel(WorkspaceViewModel parentWorkspace)
 {
     ParentWorkspace = parentWorkspace;
 }
Пример #15
0
 public NodeViewModel(WorkspaceViewModel workspaceViewModel, NodeModel logic, Size preferredSize)
     :this(workspaceViewModel, logic)
 {
     // preferredSize is set when a node needs to have a fixed size
     PreferredSize = preferredSize;
 }
Пример #16
0
 public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationModel model)
 {             
     annotationModel = model;           
     this.WorkspaceViewModel = workspaceViewModel;                                     
     model.PropertyChanged += model_PropertyChanged;
     // Group is created already.So just populate it.
     var selectNothing = new DynamoModel.SelectModelCommand(Guid.Empty, System.Windows.Input.ModifierKeys.None.AsDynamoType());
     WorkspaceViewModel.DynamoViewModel.ExecuteCommand(selectNothing);
 }
Пример #17
0
 internal StateMachine(WorkspaceViewModel owningWorkspace)
 {
     this.owningWorkspace = owningWorkspace;
 }
Пример #18
0
        private void WorkspaceAdded(WorkspaceModel item)
        {
            if (item is HomeWorkspaceModel)
            {
                var newVm = new HomeWorkspaceViewModel(item as HomeWorkspaceModel, this);
                workspaces.Insert(0, newVm);

                // The RunSettings control is a child of the DynamoView, 
                // but has its DataContext set to the RunSettingsViewModel 
                // on the HomeWorkspaceViewModel. When the home workspace is changed,
                // we need to raise a property change notification for the 
                // homespace view model, so the RunSettingsControl's bindings
                // get updated.
                RaisePropertyChanged("HomeSpaceViewModel");
            }
            else
            {
                var newVm = new WorkspaceViewModel(item, this);
                workspaces.Add(newVm);
            }
        }
Пример #19
0
        /// <summary>
        /// Construct a view and start drawing.
        /// </summary>
        /// <param name="port"></param>
        public ConnectorViewModel(WorkspaceViewModel workspace, PortModel port)
        {
            this.workspaceViewModel = workspace;
            IsConnecting = true;
            _activeStartPort = port;

            Redraw(port.Center);
        }
Пример #20
0
        protected DynamoViewModel(StartConfiguration startConfiguration)
        {
            this.ShowLogin = startConfiguration.ShowLogin;

            // initialize core data structures
            this.model = startConfiguration.DynamoModel;
            this.model.CommandStarting += OnModelCommandStarting;
            this.model.CommandCompleted += OnModelCommandCompleted;

            UsageReportingManager.Instance.InitializeCore(this);
            this.WatchHandler = startConfiguration.WatchHandler;
            var pmExtension = model.GetPackageManagerExtension();
            this.PackageManagerClientViewModel = new PackageManagerClientViewModel(this, pmExtension.PackageManagerClient);
            this.SearchViewModel = new SearchViewModel(this);

            // Start page should not show up during test mode.
            this.ShowStartPage = !DynamoModel.IsTestMode;

            this.BrandingResourceProvider = startConfiguration.BrandingResourceProvider ?? new DefaultBrandingResourceProvider();

            // commands should be initialized before adding any WorkspaceViewModel
            InitializeDelegateCommands();

            //add the initial workspace and register for future 
            //updates to the workspaces collection
            var homespaceViewModel = new HomeWorkspaceViewModel(model.CurrentWorkspace as HomeWorkspaceModel, this);
            workspaces.Add(homespaceViewModel);
            currentWorkspaceViewModel = homespaceViewModel;

            model.WorkspaceAdded += WorkspaceAdded;
            model.WorkspaceRemoved += WorkspaceRemoved;

            SubscribeModelCleaningUpEvent();
            SubscribeModelUiEvents();
            SubscribeModelChangedHandlers();
            SubscribeUpdateManagerHandlers();

            InitializeAutomationSettings(startConfiguration.CommandFilePath);

            SubscribeLoggerHandlers();

            DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;

            InitializeRecentFiles();

            UsageReportingManager.Instance.PropertyChanged += CollectInfoManager_PropertyChanged;

            WatchIsResizable = false;

            SubscribeDispatcherHandlers();

            RenderPackageFactoryViewModel = new RenderPackageFactoryViewModel(Model.PreferenceSettings);
            RenderPackageFactoryViewModel.PropertyChanged += RenderPackageFactoryViewModel_PropertyChanged;

            BackgroundPreviewViewModel = startConfiguration.Watch3DViewModel;
            BackgroundPreviewViewModel.PropertyChanged += Watch3DViewModelPropertyChanged;
            RegisterWatch3DViewModel(BackgroundPreviewViewModel, RenderPackageFactoryViewModel.Factory);
        }
Пример #21
0
 public ZoomAndPanControl(WorkspaceViewModel workspaceViewModel)
 {
     InitializeComponent();
     this.DataContext = workspaceViewModel;
 }