public static DynamoRevitViewModel Start(StartConfiguration startConfiguration)
        {
            if (startConfiguration.DynamoModel == null)
            {
                startConfiguration.DynamoModel = RevitDynamoModel.Start();
            }
            else
            {
                if (startConfiguration.DynamoModel.GetType() != typeof(RevitDynamoModel))
                {
                    throw new Exception("An instance of RevitDynamoModel is required to construct a DynamoRevitViewModel.");
                }
            }

            if (startConfiguration.Watch3DViewModel == null)
            {
                startConfiguration.Watch3DViewModel =
                    HelixWatch3DViewModel.TryCreateHelixWatch3DViewModel(
                        null,
                        new Watch3DViewModelStartupParams(startConfiguration.DynamoModel),
                        startConfiguration.DynamoModel.Logger);
            }

            if (startConfiguration.WatchHandler == null)
            {
                startConfiguration.WatchHandler = new DefaultWatchHandler(startConfiguration.DynamoModel.PreferenceSettings);
            }

            return(new DynamoRevitViewModel(startConfiguration));
        }
        public static DynamoRevitViewModel Start(StartConfiguration startConfiguration)
        {
            if (startConfiguration.DynamoModel == null)
            {
                startConfiguration.DynamoModel = RevitDynamoModel.Start();
            }
            else
            {
                if (startConfiguration.DynamoModel.GetType() != typeof(RevitDynamoModel))
                {
                    throw new Exception("An instance of RevitDynamoViewModel is required to construct a DynamoRevitViewModel.");
                }
            }

            if (startConfiguration.VisualizationManager == null)
            {
                startConfiguration.VisualizationManager = new VisualizationManager(startConfiguration.DynamoModel);
            }

            if (startConfiguration.WatchHandler == null)
            {
                startConfiguration.WatchHandler = new DefaultWatchHandler(startConfiguration.VisualizationManager,
                                                                          startConfiguration.DynamoModel.PreferenceSettings);
            }

            return(new DynamoRevitViewModel(startConfiguration));
        }
Exemple #3
0
 private InventorDynamoModel(StartConfiguration configuration) :
     base(configuration)
 {
     string       context     = configuration.Context;
     IPreferences preferences = configuration.Preferences;
     string       corePath    = configuration.DynamoCorePath;
     bool         isTestMode  = configuration.StartInTestMode;
 }
        public void StartConfigrationTest()
        {
            IStartConfiguration startConfiguration = new StartConfiguration("0 1 N");

            Assert.AreEqual(startConfiguration.GetStartPoint().Coordinate.X, 0);
            Assert.AreEqual(startConfiguration.GetStartPoint().Coordinate.Y, 1);
            Assert.AreEqual(startConfiguration.GetStartPoint().Direction, Business.Enums.Direction.North);
        }
 private InventorDynamoModel(StartConfiguration configuration) :
     base(configuration)
 {
     string context = configuration.Context;
     IPreferences preferences = configuration.Preferences;
     string corePath = configuration.DynamoCorePath;
     bool isTestMode = configuration.StartInTestMode;
 }
        private DynamoRevitViewModel(StartConfiguration startConfiguration) :
            base(startConfiguration)
        {
            var model = (RevitDynamoModel)Model;

            model.RevitDocumentChanged          += model_RevitDocumentChanged;
            model.RevitContextAvailable         += model_RevitContextAvailable;
            model.RevitContextUnavailable       += model_RevitContextUnavailable;
            model.RevitDocumentLost             += model_RevitDocumentLost;
            model.RevitViewChanged              += model_RevitViewChanged;
            model.InvalidRevitDocumentActivated += model_InvalidRevitDocumentActivated;
        }
        public new static InventorDynamoModel Start(StartConfiguration configuration)
        {
            if (string.IsNullOrEmpty(configuration.Context))
                configuration.Context = Dynamo.Core.Context.REVIT_2015;
            if (string.IsNullOrEmpty(configuration.DynamoCorePath))
            {
                var asmLocation = Assembly.GetExecutingAssembly().Location;
                configuration.DynamoCorePath = Path.GetDirectoryName(asmLocation);
            }

            if (configuration.Preferences == null)
                configuration.Preferences = new PreferenceSettings();

            return new InventorDynamoModel(configuration);
        }
Exemple #8
0
        private RevitDynamoModel(StartConfiguration configuration) :
            base(configuration)
        {
            string       context     = configuration.Context;
            IPreferences preferences = configuration.Preferences;
            string       corePath    = configuration.DynamoCorePath;
            bool         isTestMode  = configuration.StartInTestMode;

            RevitServicesUpdater = new RevitServicesUpdater(DynamoRevitApp.ControlledApplication, DynamoRevitApp.Updaters);
            SubscribeRevitServicesUpdaterEvents();

            InitializeDocumentManager();
            SubscribeDocumentManagerEvents();
            SubscribeTransactionManagerEvents();

            SetupPython();
        }
        private RevitDynamoModel(StartConfiguration configuration) :
            base(configuration)
        {
            string context = configuration.Context;
            IPreferences preferences = configuration.Preferences;
            string corePath = configuration.DynamoCorePath;
            bool isTestMode = configuration.StartInTestMode;

            RevitServicesUpdater = new RevitServicesUpdater(DynamoRevitApp.ControlledApplication, DynamoRevitApp.Updaters);
            SubscribeRevitServicesUpdaterEvents();

            InitializeDocumentManager();
            SubscribeDocumentManagerEvents();
            SubscribeTransactionManagerEvents();

            SetupPython();
        }
        public new static RevitDynamoModel Start(StartConfiguration configuration)
        {
            // where necessary, assign defaults
            if (string.IsNullOrEmpty(configuration.Context))
                configuration.Context = Core.Context.REVIT_2014;
            if (string.IsNullOrEmpty(configuration.DynamoCorePath))
            {
                var asmLocation = Assembly.GetExecutingAssembly().Location;
                configuration.DynamoCorePath = Path.GetDirectoryName(asmLocation);
            }

            if (configuration.Preferences == null)
                configuration.Preferences = new PreferenceSettings();
            if (configuration.Runner == null)
                configuration.Runner = new RevitDynamoRunner();

            return new RevitDynamoModel(configuration);
        }
Exemple #11
0
        public new static InventorDynamoModel Start(StartConfiguration configuration)
        {
            if (string.IsNullOrEmpty(configuration.Context))
            {
                configuration.Context = Dynamo.Core.Context.REVIT_2015;
            }
            if (string.IsNullOrEmpty(configuration.DynamoCorePath))
            {
                var asmLocation = Assembly.GetExecutingAssembly().Location;
                configuration.DynamoCorePath = Path.GetDirectoryName(asmLocation);
            }

            if (configuration.Preferences == null)
            {
                configuration.Preferences = new PreferenceSettings();
            }

            return(new InventorDynamoModel(configuration));
        }
Exemple #12
0
        public void StartIsNotOnBoard()
        {
            IBoardConfiguration boardConfiguration = new BoardConfiguration("5 4");
            IExitConfiguration  exitConfiguration  = new ExitConfiguration("4 2");
            IMinesConfiguration minesConfiguration = new MinesConfiguration("1,1 1,3 3,3");
            IMoveConfiguration  moveConfiguration  = new MoveConfiguration(new List <string>()
            {
                "M R L", "L M R", "R M L"
            });
            IStartConfiguration startConfiguration = new StartConfiguration("6 9 N");

            IBoard                  board  = boardConfiguration.GetBoard();
            List <ICoordinate>      mines  = minesConfiguration.GetMines();
            ICoordinate             exit   = exitConfiguration.GetExitPoint();
            IPosition               start  = startConfiguration.GetStartPoint();
            List <List <MoveType> > moves  = moveConfiguration.GetMoves();
            ITurtle                 turtle = new Turtle(start);

            IGameValidator gameValidator = new GameValidator(board, mines, exit, start, moves, turtle);

            gameValidator.Validate();
        }
        private DynamoRevitViewModel(StartConfiguration startConfiguration) :
            base(startConfiguration)
        {
            var model = (RevitDynamoModel)Model;

            model.RevitDocumentChanged          += model_RevitDocumentChanged;
            model.RevitContextAvailable         += model_RevitContextAvailable;
            model.RevitContextUnavailable       += model_RevitContextUnavailable;
            model.RevitDocumentLost             += model_RevitDocumentLost;
            model.RevitViewChanged              += model_RevitViewChanged;
            model.InvalidRevitDocumentActivated += model_InvalidRevitDocumentActivated;

            if (RevitWatch3DViewModel.GetTransientDisplayMethod() == null)
            {
                return;
            }

            var watch3DParams = new Watch3DViewModelStartupParams(model);
            var watch3DVm     = new RevitWatch3DViewModel(watch3DParams);

            RegisterWatch3DViewModel(watch3DVm, new DefaultRenderPackageFactory());
        }
Exemple #14
0
        public new static RevitDynamoModel Start(StartConfiguration configuration)
        {
            // where necessary, assign defaults
            if (string.IsNullOrEmpty(configuration.Context))
            {
                configuration.Context = Core.Context.REVIT_2014;
            }
            if (string.IsNullOrEmpty(configuration.DynamoCorePath))
            {
                var asmLocation = Assembly.GetExecutingAssembly().Location;
                configuration.DynamoCorePath = Path.GetDirectoryName(asmLocation);
            }

            if (configuration.Preferences == null)
            {
                configuration.Preferences = new PreferenceSettings();
            }
            if (configuration.Runner == null)
            {
                configuration.Runner = new RevitDynamoRunner();
            }

            return(new RevitDynamoModel(configuration));
        }
Exemple #15
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;
            WatchHandler.RequestSelectGeometry += BackgroundPreviewViewModel.AddLabelForPath;
            RegisterWatch3DViewModel(BackgroundPreviewViewModel, RenderPackageFactoryViewModel.Factory);
        }
Exemple #16
0
        public static DynamoViewModel Start(StartConfiguration startConfiguration = new StartConfiguration())
        {
            if(startConfiguration.DynamoModel == null) 
                startConfiguration.DynamoModel = DynamoModel.Start();

            if(startConfiguration.WatchHandler == null)
                startConfiguration.WatchHandler = new DefaultWatchHandler(startConfiguration.DynamoModel.PreferenceSettings);

            if (startConfiguration.Watch3DViewModel == null)
            {
                startConfiguration.Watch3DViewModel = HelixWatch3DViewModel.TryCreateHelixWatch3DViewModel(
                    new Watch3DViewModelStartupParams(startConfiguration.DynamoModel), startConfiguration.DynamoModel.Logger);
            }

            return new DynamoViewModel(startConfiguration);
        }
Exemple #17
0
        protected DynamoModel(StartConfiguration configuration)
        {
            string context = configuration.Context;
            IPreferences preferences = configuration.Preferences;
            string corePath = configuration.DynamoCorePath;
            DynamoRunner runner = configuration.Runner;
            bool isTestMode = configuration.StartInTestMode;

            DynamoPathManager.Instance.InitializeCore(corePath);
            UsageReportingManager.Instance.InitializeCore(this);

            Runner = runner;
            Context = context;
            IsTestMode = isTestMode;
            Logger = new DynamoLogger(this, DynamoPathManager.Instance.Logs);
            DebugSettings = new DebugSettings();

#if ENABLE_DYNAMO_SCHEDULER
            var thread = configuration.SchedulerThread ?? new DynamoSchedulerThread();
            scheduler = new DynamoScheduler(thread);
#endif

            if (preferences is PreferenceSettings)
            {
                this.PreferenceSettings = preferences as PreferenceSettings;
                PreferenceSettings.PropertyChanged += PreferenceSettings_PropertyChanged;
            }

            InitializePreferences(preferences);
            InitializeInstrumentationLogger();

            UpdateManager.UpdateManager.Instance.CheckForProductUpdate(new UpdateRequest(new Uri(Configurations.UpdateDownloadLocation)));

            SearchModel = new SearchModel(this);

            InitializeCurrentWorkspace();

            this.CustomNodeManager = new CustomNodeManager(this, DynamoPathManager.Instance.UserDefinitions);
            this.Loader = new DynamoLoader(this);

            this.Loader.PackageLoader.DoCachedPackageUninstalls();
            this.Loader.PackageLoader.LoadPackages();

            DisposeLogic.IsShuttingDown = false;

            this.EngineController = new EngineController(this, DynamoPathManager.Instance.GeometryFactory);
            this.CustomNodeManager.RecompileAllNodes(EngineController);

            // Reset virtual machine to avoid a race condition by causing a 
            // thread join inside the vm exec. Since DynamoModel is being called 
            // on the main/idle thread, it is safe to call ResetEngineInternal 
            // directly (we cannot call virtual method ResetEngine here).
            // 
            ResetEngineInternal();
            Nodes.ForEach(n => n.RequiresRecalc = true);

            Logger.Log(String.Format(
                "Dynamo -- Build {0}",
                Assembly.GetExecutingAssembly().GetName().Version));

            this.Loader.ClearCachedAssemblies();
            this.Loader.LoadNodeModels();

            MigrationManager.Instance.MigrationTargets.Add(typeof(WorkspaceMigrations));

            PackageManagerClient = new PackageManagerClient(this);
        }