Ejemplo n.º 1
0
        public void Init()
        {
            //Create an instance of the UpdateManager class to be used in the tests.
            var config = UpdateManagerConfiguration.GetSettings(null);

            updateManager = new UpdateManager(config);
        }
Ejemplo n.º 2
0
        private static RevitDynamoModel InitializeCoreModel(DynamoRevitCommandData commandData)
        {
            var assemblyLocation  = Assembly.GetExecutingAssembly().Location;
            var assemblyDirectory = Path.GetDirectoryName(assemblyLocation);
            var parentDirectory   = Directory.GetParent(assemblyDirectory);
            var corePath          = parentDirectory.FullName;

            var umConfig = UpdateManagerConfiguration.GetSettings(new DynamoRevitLookUp());

            Debug.Assert(umConfig.DynamoLookUp != null);

            return(RevitDynamoModel.Start(
                       new RevitDynamoModel.RevitStartConfiguration()
            {
                GeometryFactoryPath = GetGeometryFactoryPath(corePath),
                PathResolver = new RevitPathResolver(),
                Context = GetRevitContext(commandData),
                SchedulerThread = new RevitSchedulerThread(commandData.Application),
                StartInTestMode = isAutomationMode,
                AuthProvider = new RevitOxygenProvider(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher)),
                ExternalCommandData = commandData,
                UpdateManager = new DynUpdateManager(umConfig),
                ProcessMode = isAutomationMode ? TaskProcessMode.Synchronous : TaskProcessMode.Asynchronous
            }));
        }
Ejemplo n.º 3
0
        private static RevitDynamoModel InitializeCoreModel(DynamoRevitCommandData commandData)
        {
            var corePath           = DynamoRevitApp.DynamoCorePath;
            var dynamoRevitExePath = Assembly.GetExecutingAssembly().Location;
            var dynamoRevitRoot    = Path.GetDirectoryName(dynamoRevitExePath);// ...\Revit_xxxx\ folder

            var umConfig = UpdateManagerConfiguration.GetSettings(new DynamoRevitLookUp());

            Debug.Assert(umConfig.DynamoLookUp != null);

            var userDataFolder = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                "Dynamo", "Dynamo Revit");
            var commonDataFolder = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
                "Dynamo", "Dynamo Revit");

            return(RevitDynamoModel.Start(
                       new RevitDynamoModel.RevitStartConfiguration()
            {
                DynamoCorePath = corePath,
                DynamoHostPath = dynamoRevitRoot,
                GeometryFactoryPath = GetGeometryFactoryPath(corePath),
                PathResolver = new RevitPathResolver(userDataFolder, commonDataFolder),
                Context = GetRevitContext(commandData),
                SchedulerThread = new RevitSchedulerThread(commandData.Application),
                StartInTestMode = isAutomationMode,
                AuthProvider = new RevitOxygenProvider(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher)),
                ExternalCommandData = commandData,
                UpdateManager = new DynUpdateManager(umConfig),
                ProcessMode = isAutomationMode ? TaskProcessMode.Synchronous : TaskProcessMode.Asynchronous
            }));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///if we are building a model for CLI mode, then we don't want to start an updateManager
        ///for now, building an updatemanager instance requires finding Dynamo install location
        ///which if we are running on mac os or *nix will use different logic then SandboxLookup
        /// </summary>
        private static IUpdateManager InitializeUpdateManager()
        {
            var cfg = UpdateManagerConfiguration.GetSettings(new SandboxLookUp());
            var um  = new Dynamo.Updates.UpdateManager(cfg);

            Debug.Assert(cfg.DynamoLookUp != null);
            return(um);
        }
Ejemplo n.º 5
0
        private static RevitDynamoModel InitializeCoreModel(DynamoRevitCommandData commandData)
        {
            // Temporary fix to pre-load DLLs that were also referenced in Revit folder.
            // To do: Need to align with Revit when provided a chance.
            PreloadDynamoCoreDlls();
            var corePath           = DynamoRevitApp.DynamoCorePath;
            var dynamoRevitExePath = Assembly.GetExecutingAssembly().Location;
            var dynamoRevitRoot    = Path.GetDirectoryName(dynamoRevitExePath);// ...\Revit_xxxx\ folder

            // get Dynamo Revit Version
            var dynRevitVersion = Assembly.GetExecutingAssembly().GetName().Version;

            var umConfig           = UpdateManagerConfiguration.GetSettings(new DynamoRevitLookUp());
            var revitUpdateManager = new DynUpdateManager(umConfig);

            revitUpdateManager.HostVersion = dynRevitVersion; // update RevitUpdateManager with the current DynamoRevit Version
            revitUpdateManager.HostName    = "Dynamo Revit";
            if (revitUpdateManager.Configuration is IDisableUpdateConfig)
            {
                (revitUpdateManager.Configuration as IDisableUpdateConfig).DisableUpdates = true;
            }

            Debug.Assert(umConfig.DynamoLookUp != null);

            var userDataFolder = Path.Combine(Environment.GetFolderPath(
                                                  Environment.SpecialFolder.ApplicationData),
                                              "Dynamo", "Dynamo Revit");
            var commonDataFolder = Path.Combine(Environment.GetFolderPath(
                                                    Environment.SpecialFolder.CommonApplicationData),
                                                "Autodesk", "RVT " + commandData.Application.Application.VersionNumber, "Dynamo");

            bool isAutomationMode = CheckJournalForKey(extCommandData, JournalKeys.AutomationModeKey);

            // when Dynamo runs on top of Revit we must load the same version of ASM as revit
            // so tell Dynamo core we've loaded that version.
            var loadedLibGVersion = PreloadAsmFromRevit();


            return(RevitDynamoModel.Start(
                       new RevitDynamoModel.RevitStartConfiguration()
            {
                DynamoCorePath = corePath,
                DynamoHostPath = dynamoRevitRoot,
                GeometryFactoryPath = GetGeometryFactoryPath(corePath, loadedLibGVersion),
                PathResolver = new RevitPathResolver(userDataFolder, commonDataFolder),
                Context = GetRevitContext(commandData),
                SchedulerThread = new RevitSchedulerThread(commandData.Application),
                StartInTestMode = isAutomationMode,
                AuthProvider = new RevitOxygenProvider(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher)),
                ExternalCommandData = commandData,
                UpdateManager = revitUpdateManager,
                ProcessMode = isAutomationMode ? TaskProcessMode.Synchronous : TaskProcessMode.Asynchronous
            }));
        }
Ejemplo n.º 6
0
        private static void MakeStandaloneAndRun(string commandFilePath, out DynamoViewModel viewModel)
        {
            var geometryFactoryPath = string.Empty;
            var preloaderLocation   = string.Empty;

            PreloadShapeManager(ref geometryFactoryPath, ref preloaderLocation);

            DynamoModel.RequestMigrationStatusDialog += MigrationStatusDialogRequested;

            var umConfig = UpdateManagerConfiguration.GetSettings(new SandboxLookUp());

            Debug.Assert(umConfig.DynamoLookUp != null);

            var model = DynamoModel.Start(
                new DynamoModel.DefaultStartConfiguration()
            {
                PathResolver        = new PathResolver(preloaderLocation),
                GeometryFactoryPath = geometryFactoryPath,
                UpdateManager       = new UpdateManager(umConfig)
            });

            viewModel = DynamoViewModel.Start(
                new DynamoViewModel.StartConfiguration()
            {
                CommandFilePath = commandFilePath,
                DynamoModel     = model
            });

            var view = new DynamoView(viewModel);

            view.Loaded += (sender, args) => CloseMigrationWindow();

            var app = new Application();

            app.Run(view);

            DynamoModel.RequestMigrationStatusDialog -= MigrationStatusDialogRequested;
        }
Ejemplo n.º 7
0
        public void Init()
        {
            var config = UpdateManagerConfiguration.GetSettings(null);

            updateManager = new UpdateManager(config);
        }