コード例 #1
0
 internal PlaybackStateChangedEventArgs(string oldCommandTag, string newCommandTag,
     AutomationSettings.State oldState, AutomationSettings.State newState)
 {
     OldState = oldState;
     NewState = newState;
     OldTag = oldCommandTag;
     NewTag = newCommandTag;
 }
コード例 #2
0
        public DynamoViewModel(DynamoController controller, string commandFilePath)
        {
            //create the model
            _model = new DynamoModel();
            dynSettings.Controller.DynamoModel = _model;

            //register for property change notifications
            //on the model and the controller
            _model.PropertyChanged += _model_PropertyChanged;
            dynSettings.Controller.PropertyChanged += Controller_PropertyChanged;
            _model.Workspaces.CollectionChanged += Workspaces_CollectionChanged;

            _model.AddHomeWorkspace();
            _model.CurrentWorkspace = _model.HomeSpace;

            Controller = controller;

            //Register for a notification when the update manager downloads an update
            dynSettings.Controller.UpdateManager.UpdateDownloaded += Instance_UpdateDownloaded;

            // Instantiate an AutomationSettings to handle record/playback.
            automationSettings = new AutomationSettings(this, commandFilePath);

            OpenCommand = new DelegateCommand(_model.Open, _model.CanOpen);
            ShowOpenDialogAndOpenResultCommand = new DelegateCommand(_model.ShowOpenDialogAndOpenResult, _model.CanShowOpenDialogAndOpenResultCommand);
            WriteToLogCmd = new DelegateCommand(_model.WriteToLog, _model.CanWriteToLog);
            PostUiActivationCommand = new DelegateCommand(_model.PostUIActivation, _model.CanDoPostUIActivation);
            AddNoteCommand = new DelegateCommand(_model.AddNote, _model.CanAddNote);
            AddToSelectionCommand = new DelegateCommand(_model.AddToSelection, _model.CanAddToSelection);
            ShowNewFunctionDialogCommand = new DelegateCommand(_model.ShowNewFunctionDialogAndMakeFunction, _model.CanShowNewFunctionDialogCommand);
            SaveRecordedCommand = new DelegateCommand(SaveRecordedCommands, CanSaveRecordedCommands);
            InsertPausePlaybackCommand = new DelegateCommand(ExecInsertPausePlaybackCommand, CanInsertPausePlaybackCommand);
            GoHomeCommand = new DelegateCommand(GoHomeView, CanGoHomeView);
            SelectAllCommand = new DelegateCommand(SelectAll, CanSelectAll);
            ShowSaveDialogAndSaveResultCommand = new DelegateCommand(ShowSaveDialogAndSaveResult, CanShowSaveDialogAndSaveResult);
            SaveCommand = new DelegateCommand(_model.Save, _model.CanSave);
            SaveAsCommand = new DelegateCommand(_model.SaveAs, _model.CanSaveAs);
            HomeCommand = new DelegateCommand(_model.Home, _model.CanGoHome);
            NewHomeWorkspaceCommand = new DelegateCommand(MakeNewHomeWorkspace, CanMakeNewHomeWorkspace);
            GoToWorkspaceCommand = new DelegateCommand(GoToWorkspace, CanGoToWorkspace);
            DeleteCommand = new DelegateCommand(_model.Delete, _model.CanDelete);
            ExitCommand = new DelegateCommand(Exit, CanExit);
            ToggleFullscreenWatchShowingCommand = new DelegateCommand(ToggleFullscreenWatchShowing, CanToggleFullscreenWatchShowing);
            ToggleCanNavigateBackgroundCommand = new DelegateCommand(ToggleCanNavigateBackground, CanToggleCanNavigateBackground);
            AlignSelectedCommand = new DelegateCommand(AlignSelected, CanAlignSelected); ;
            ShowSaveDialogIfNeededAndSaveResultCommand = new DelegateCommand(ShowSaveDialogIfNeededAndSaveResult, CanShowSaveDialogIfNeededAndSaveResultCommand);
            SaveImageCommand = new DelegateCommand(SaveImage, CanSaveImage);
            ShowSaveImageDialogAndSaveResultCommand = new DelegateCommand(ShowSaveImageDialogAndSaveResult, CanShowSaveImageDialogAndSaveResult);
            UndoCommand = new DelegateCommand(Undo, CanUndo);
            RedoCommand = new DelegateCommand(Redo, CanRedo);
            CopyCommand = new DelegateCommand(_model.Copy, _model.CanCopy);
            PasteCommand = new DelegateCommand(_model.Paste, _model.CanPaste);
            ToggleConsoleShowingCommand = new DelegateCommand(ToggleConsoleShowing, CanToggleConsoleShowing);
            CancelRunCommand = new DelegateCommand(Controller.CancelRunCmd, Controller.CanCancelRunCmd);
            RunExpressionCommand = new DelegateCommand(Controller.RunExprCmd, Controller.CanRunExprCmd);
            DisplayFunctionCommand = new DelegateCommand(Controller.DisplayFunction, Controller.CanDisplayFunction);
            SetConnectorTypeCommand = new DelegateCommand(SetConnectorType, CanSetConnectorType);
            ReportABugCommand = new DelegateCommand(Controller.ReportABug, Controller.CanReportABug);
            GoToWikiCommand = new DelegateCommand(GoToWiki, CanGoToWiki);
            GoToSourceCodeCommand = new DelegateCommand(GoToSourceCode, CanGoToSourceCode);
            ShowPackageManagerSearchCommand = new DelegateCommand(ShowPackageManagerSearch, CanShowPackageManagerSearch);
            ShowInstalledPackagesCommand = new DelegateCommand(ShowInstalledPackages, CanShowInstalledPackages);
            PublishCurrentWorkspaceCommand = new DelegateCommand(PublishCurrentWorkspace, CanPublishCurrentWorkspace);
            PublishSelectedNodesCommand = new DelegateCommand(PublishSelectedNodes, CanPublishSelectedNodes);
            ShowHideConnectorsCommand = new DelegateCommand(ShowConnectors, CanShowConnectors);
            SelectNeighborsCommand = new DelegateCommand(SelectNeighbors, CanSelectNeighbors);
            ClearLogCommand = new DelegateCommand(dynSettings.Controller.ClearLog, dynSettings.Controller.CanClearLog);
            PanCommand = new DelegateCommand(Pan, CanPan);
            ZoomInCommand = new DelegateCommand(ZoomIn, CanZoomIn);
            ZoomOutCommand = new DelegateCommand(ZoomOut, CanZoomOut);
            FitViewCommand = new DelegateCommand(FitView, CanFitView);
            TogglePanCommand = new DelegateCommand(TogglePan, CanTogglePan);
            EscapeCommand = new DelegateCommand(Escape, CanEscape);
            SelectVisualizationInViewCommand = new DelegateCommand(SelectVisualizationInView, CanSelectVisualizationInView);
            GetBranchVisualizationCommand = new DelegateCommand(GetBranchVisualization, CanGetBranchVisualization);
            TogglePreviewBubbleVisibilityCommand = new DelegateCommand(TogglePreviewBubbleVisibility, CanTogglePreviewBubbleVisibility);
            ExportToSTLCommand = new DelegateCommand(ExportToSTL, CanExportToSTL);
            ImportLibraryCommand = new DelegateCommand(ImportLibrary, CanImportLibrary);
            SetLengthUnitCommand = new DelegateCommand(SetLengthUnit, CanSetLengthUnit);
            SetAreaUnitCommand = new DelegateCommand(SetAreaUnit, CanSetAreaUnit);
            SetVolumeUnitCommand = new DelegateCommand(SetVolumeUnit, CanSetVolumeUnit);
            ShowAboutWindowCommand = new DelegateCommand(ShowAboutWindow, CanShowAboutWindow);
            CheckForUpdateCommand = new DelegateCommand(CheckForUpdate, CanCheckForUpdate);
            SetNumberFormatCommand = new DelegateCommand(SetNumberFormat, CanSetNumberFormat);

            DynamoLogger.Instance.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Instance_PropertyChanged);

            DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;
            dynSettings.Controller.VisualizationManager.PropertyChanged += VisualizationManager_PropertyChanged;

            this.Model.PropertyChanged += (e, args) =>
            {
                if (args.PropertyName == "CurrentWorkspace" && dynSettings.Controller.DynamoModel.CurrentWorkspace != null)
                {
                    var visibleWorkspace =
                        (dynSettings.Controller.DynamoModel.CurrentWorkspace is CustomNodeWorkspaceModel);

                    dynSettings.Controller.SearchViewModel.SearchElements
                        .Where(x => x.Name == "Input" || x.Name == "Output")
                        .OfType<NodeSearchElement>()
                        .ToList()
                        .ForEach(x => x.SetSearchable(visibleWorkspace));

                    dynSettings.Controller.SearchViewModel.SearchAndUpdateResultsSync();
                }
            };

            UsageReportingManager.Instance.PropertyChanged += CollectInfoManager_PropertyChanged;

            WatchIsResizable = false;
        }
コード例 #3
0
        private void InitializeAutomationSettings(string commandFilePath)
        {
            if (String.IsNullOrEmpty(commandFilePath) || !File.Exists(commandFilePath))
                commandFilePath = null;

            // Instantiate an AutomationSettings to handle record/playback.
            automationSettings = new AutomationSettings(this.Model, commandFilePath);
        }
コード例 #4
0
ファイル: DynamoViewModel.cs プロジェクト: heegwon/Dynamo
        public DynamoViewModel(DynamoController controller, string commandFilePath)
        {
            Controller = controller;
            _model = controller.DynamoModel;

            //add the initial workspace and register for future 
            //updates to the workspaces collection
            _workspaces.Add(new WorkspaceViewModel(_model.HomeSpace, this));
            _model.Workspaces.CollectionChanged += Workspaces_CollectionChanged;

            //register for property change notifications 
            //on the model and the controller
            _model.PropertyChanged += _model_PropertyChanged;
            dynSettings.Controller.PropertyChanged += Controller_PropertyChanged;
            
            //Register for a notification when the update manager downloads an update
            dynSettings.Controller.UpdateManager.UpdateDownloaded += Instance_UpdateDownloaded;
            dynSettings.Controller.UpdateManager.ShutdownRequested += updateManager_ShutdownRequested;

            // Instantiate an AutomationSettings to handle record/playback.
            automationSettings = new AutomationSettings(this, commandFilePath);

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

            #region File Handling Commands

            OpenCommand = new DelegateCommand(Open, CanOpen);
            OpenRecentCommand = new DelegateCommand(OpenRecent, CanOpenRecent);
            SaveCommand = new DelegateCommand(Save, CanSave);
            SaveAsCommand = new DelegateCommand(SaveAs, CanSaveAs);
            ShowOpenDialogAndOpenResultCommand = new DelegateCommand(ShowOpenDialogAndOpenResult, CanShowOpenDialogAndOpenResultCommand);
            ShowSaveDialogAndSaveResultCommand = new DelegateCommand(ShowSaveDialogAndSaveResult, CanShowSaveDialogAndSaveResult);
            ShowSaveDialogIfNeededAndSaveResultCommand = new DelegateCommand(ShowSaveDialogIfNeededAndSaveResult, CanShowSaveDialogIfNeededAndSaveResultCommand);
            SaveImageCommand = new DelegateCommand(SaveImage, CanSaveImage);
            ShowSaveImageDialogAndSaveResultCommand = new DelegateCommand(ShowSaveImageDialogAndSaveResult, CanShowSaveImageDialogAndSaveResult);

            #endregion

            WriteToLogCmd = new DelegateCommand(_model.WriteToLog, _model.CanWriteToLog);
            PostUiActivationCommand = new DelegateCommand(_model.PostUIActivation, _model.CanDoPostUIActivation);
            AddNoteCommand = new DelegateCommand(_model.AddNote, _model.CanAddNote);
            AddToSelectionCommand = new DelegateCommand(_model.AddToSelection, _model.CanAddToSelection);
            ShowNewFunctionDialogCommand = new DelegateCommand(ShowNewFunctionDialogAndMakeFunction, CanShowNewFunctionDialogCommand);
            SaveRecordedCommand = new DelegateCommand(SaveRecordedCommands, CanSaveRecordedCommands);
            InsertPausePlaybackCommand = new DelegateCommand(ExecInsertPausePlaybackCommand, CanInsertPausePlaybackCommand);
            GraphAutoLayoutCommand = new DelegateCommand(DoGraphAutoLayout, CanDoGraphAutoLayout);
            GoHomeCommand = new DelegateCommand(GoHomeView, CanGoHomeView);
            SelectAllCommand = new DelegateCommand(SelectAll, CanSelectAll);
            HomeCommand = new DelegateCommand(_model.Home, _model.CanGoHome);
            NewHomeWorkspaceCommand = new DelegateCommand(MakeNewHomeWorkspace, CanMakeNewHomeWorkspace);
            CloseHomeWorkspaceCommand = new DelegateCommand(CloseHomeWorkspace, CanCloseHomeWorkspace);
            GoToWorkspaceCommand = new DelegateCommand(GoToWorkspace, CanGoToWorkspace);
            DeleteCommand = new DelegateCommand(_model.Delete, _model.CanDelete);
            ExitCommand = new DelegateCommand(Exit, CanExit);
            ToggleFullscreenWatchShowingCommand = new DelegateCommand(ToggleFullscreenWatchShowing, CanToggleFullscreenWatchShowing);
            ToggleCanNavigateBackgroundCommand = new DelegateCommand(ToggleCanNavigateBackground, CanToggleCanNavigateBackground);
            AlignSelectedCommand = new DelegateCommand(AlignSelected, CanAlignSelected); ;
            UndoCommand = new DelegateCommand(Undo, CanUndo);
            RedoCommand = new DelegateCommand(Redo, CanRedo);
            CopyCommand = new DelegateCommand(_model.Copy, _model.CanCopy);
            PasteCommand = new DelegateCommand(_model.Paste, _model.CanPaste);
            ToggleConsoleShowingCommand = new DelegateCommand(ToggleConsoleShowing, CanToggleConsoleShowing);
            CancelRunCommand = new DelegateCommand(Controller.CancelRunCmd, Controller.CanCancelRunCmd);
            RunExpressionCommand = new DelegateCommand(Controller.RunExprCmd, Controller.CanRunExprCmd);
            ForceRunExpressionCommand = new DelegateCommand(Controller.ForceRunExprCmd, Controller.CanRunExprCmd);
            MutateTestDelegateCommand = new DelegateCommand(Controller.MutateTestCmd, Controller.CanRunExprCmd);
            DisplayFunctionCommand = new DelegateCommand(Controller.DisplayFunction, Controller.CanDisplayFunction);
            SetConnectorTypeCommand = new DelegateCommand(SetConnectorType, CanSetConnectorType);
            ReportABugCommand = new DelegateCommand(Controller.ReportABug, Controller.CanReportABug);
            GoToWikiCommand = new DelegateCommand(GoToWiki, CanGoToWiki);
            GoToSourceCodeCommand = new DelegateCommand(GoToSourceCode, CanGoToSourceCode);
            DisplayStartPageCommand = new DelegateCommand(DisplayStartPage, CanDisplayStartPage);
            ShowPackageManagerSearchCommand = new DelegateCommand(ShowPackageManagerSearch, CanShowPackageManagerSearch);
            ShowInstalledPackagesCommand = new DelegateCommand(ShowInstalledPackages, CanShowInstalledPackages);
            PublishCurrentWorkspaceCommand = new DelegateCommand(PublishCurrentWorkspace, CanPublishCurrentWorkspace);
            PublishSelectedNodesCommand = new DelegateCommand(PublishSelectedNodes, CanPublishSelectedNodes);
            ShowHideConnectorsCommand = new DelegateCommand(ShowConnectors, CanShowConnectors);
            SelectNeighborsCommand = new DelegateCommand(SelectNeighbors, CanSelectNeighbors);
            ClearLogCommand = new DelegateCommand(dynSettings.Controller.ClearLog, dynSettings.Controller.CanClearLog);
            PanCommand = new DelegateCommand(Pan, CanPan);
            ZoomInCommand = new DelegateCommand(ZoomIn, CanZoomIn);
            ZoomOutCommand = new DelegateCommand(ZoomOut, CanZoomOut);
            FitViewCommand = new DelegateCommand(FitView, CanFitView);
            TogglePanCommand = new DelegateCommand(TogglePan, CanTogglePan);
            ToggleOrbitCommand = new DelegateCommand(ToggleOrbit, CanToggleOrbit);
            EscapeCommand = new DelegateCommand(Escape, CanEscape);
            ExportToSTLCommand = new DelegateCommand(ExportToSTL, CanExportToSTL);
            ImportLibraryCommand = new DelegateCommand(ImportLibrary, CanImportLibrary);
            SetLengthUnitCommand = new DelegateCommand(SetLengthUnit, CanSetLengthUnit);
            SetAreaUnitCommand = new DelegateCommand(SetAreaUnit, CanSetAreaUnit);
            SetVolumeUnitCommand = new DelegateCommand(SetVolumeUnit, CanSetVolumeUnit);
            ShowAboutWindowCommand = new DelegateCommand(ShowAboutWindow, CanShowAboutWindow);
            CheckForUpdateCommand = new DelegateCommand(CheckForUpdate, CanCheckForUpdate);
            SetNumberFormatCommand = new DelegateCommand(SetNumberFormat, CanSetNumberFormat);

            SelectVisualizationInViewCommand = new DelegateCommand(SelectVisualizationInView, CanSelectVisualizationInView);
            GetBranchVisualizationCommand = new DelegateCommand(GetBranchVisualization, CanGetBranchVisualization);
            CheckForLatestRenderCommand = new DelegateCommand(CheckForLatestRender, CanCheckForLatestRender);

            ((DynamoLogger)dynSettings.DynamoLogger).PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Instance_PropertyChanged);

            DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;

            this.RecentFiles = new ObservableCollection<string>( Controller.PreferenceSettings.RecentFiles );
            this.RecentFiles.CollectionChanged += (sender, args) =>
            {
                Controller.PreferenceSettings.RecentFiles = this.RecentFiles.ToList();
            };

            UsageReportingManager.Instance.PropertyChanged += CollectInfoManager_PropertyChanged;

            WatchIsResizable = false;
            
        }