Example #1
0
        /// <summary>
        ///     Class constructor
        /// </summary>
        public DynamoController(ExecutionEnvironment env,
                                Type viewModelType, string context, string commandFilePath)
        {
            DynamoLogger.Instance.StartLogging();

            dynSettings.Controller = this;

            this.Context = context;

            //Start heartbeat reporting
            Services.InstrumentationLogger.Start();

            //create the view model to which the main window will bind
            //the DynamoModel is created therein
            this.DynamoViewModel = (DynamoViewModel)Activator.CreateInstance(
                viewModelType, new object[] { this, commandFilePath });

            // custom node loader
            string directory   = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string pluginsPath = Path.Combine(directory, "definitions");

            CustomNodeManager = new CustomNodeManager(pluginsPath);

            SearchViewModel = new SearchViewModel();

            dynSettings.PackageLoader = new PackageLoader();

            dynSettings.PackageLoader.DoCachedPackageUninstalls();
            dynSettings.PackageLoader.LoadPackages();

            FSchemeEnvironment = env;

            DynamoViewModel.Model.CurrentWorkspace.X = 0;
            DynamoViewModel.Model.CurrentWorkspace.Y = 0;

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

            DynamoLoader.ClearCachedAssemblies();
            DynamoLoader.LoadBuiltinTypes();

            //run tests
            if (FScheme.RunTests(DynamoLogger.Instance.Log))
            {
                DynamoLogger.Instance.Log("All Tests Passed. Core library loaded OK.");
            }

            this.InfoBubbleViewModel = new InfoBubbleViewModel();

            AddPythonBindings();
        }
        public bool RegisterWithHost()
        {
            dynSettings.Bench.Dispatcher.BeginInvoke((Action)(() =>
            {
                dynSettings.PackageLoader.AppendBinarySearchPath();
                DynamoLoader.LoadBuiltinTypes();

                dynSettings.PackageLoader.AppendCustomNodeSearchPaths(dynSettings.CustomNodeLoader);
                DynamoLoader.LoadCustomNodes();
            }));

            return(false);
        }
Example #3
0
        /// <summary>
        ///     Class constructor
        /// </summary>
        public DynamoController(ExecutionEnvironment env, Type viewModelType, string context)
        {
            dynSettings.Controller = this;

            this.Context = context;

            //Start heartbeat reporting
            Services.InstrumentationLogger.Start();

            //create the view model to which the main window will bind
            //the DynamoModel is created therein
            this.DynamoViewModel = (DynamoViewModel)Activator.CreateInstance(viewModelType, new object[] { this });

            // custom node loader
            string directory   = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string pluginsPath = Path.Combine(directory, "definitions");

            CustomNodeManager = new CustomNodeManager(pluginsPath);

            SearchViewModel                  = new SearchViewModel();
            PackageManagerClient             = new PackageManagerClient();
            dynSettings.PackageManagerClient = PackageManagerClient;
            PublishPackageViewModel          = new PublishPackageViewModel(PackageManagerClient);

            dynSettings.PackageLoader = new PackageLoader();

            dynSettings.PackageLoader.DoCachedPackageUninstalls();
            dynSettings.PackageLoader.LoadPackages();

            FSchemeEnvironment = env;

            DynamoViewModel.Model.CurrentSpace.X = DynamoView.CANVAS_OFFSET_X;
            DynamoViewModel.Model.CurrentSpace.Y = DynamoView.CANVAS_OFFSET_Y;

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

            DynamoLoader.ClearCachedAssemblies();
            DynamoLoader.LoadBuiltinTypes();

            //run tests
            if (FScheme.RunTests(dynSettings.Controller.DynamoViewModel.Log))
            {
                dynSettings.Controller.DynamoViewModel.Log("All Tests Passed. Core library loaded OK.");
            }

            NodeSubmittedForRendering += new EventHandler(Controller_NodeSubmittedForRendering);
            NodeRemovedFromRendering  += new EventHandler(Controller_NodeRemovedFromRendering);
        }
Example #4
0
        /// <summary>
        ///     Class constructor
        /// </summary>
        public DynamoController(ExecutionEnvironment env,
                                Type viewModelType, string context, string commandFilePath, IUpdateManager updateManager, IUnitsManager units, IWatchHandler watchHandler, IPreferences preferences)
        {
            DynamoLogger.Instance.StartLogging();

            dynSettings.Controller = this;

            this.Context = context;

            //Start heartbeat reporting
            Services.InstrumentationLogger.Start();

            PreferenceSettings = preferences;
            ((PreferenceSettings)PreferenceSettings).PropertyChanged += PreferenceSettings_PropertyChanged;

            UnitsManager              = units;
            UnitsManager.LengthUnit   = PreferenceSettings.LengthUnit;
            UnitsManager.AreaUnit     = PreferenceSettings.AreaUnit;
            UnitsManager.VolumeUnit   = PreferenceSettings.VolumeUnit;
            UnitsManager.NumberFormat = PreferenceSettings.NumberFormat;

            UpdateManager = updateManager;
            UpdateManager.UpdateDownloaded  += updateManager_UpdateDownloaded;
            UpdateManager.ShutdownRequested += updateManager_ShutdownRequested;
            UpdateManager.CheckForProductUpdate(new UpdateRequest(new Uri(Configurations.UpdateDownloadLocation), DynamoLogger.Instance, UpdateManager.UpdateDataAvailable));

            WatchHandler = watchHandler;

            //create the view model to which the main window will bind
            //the DynamoModel is created therein
            this.DynamoViewModel = (DynamoViewModel)Activator.CreateInstance(
                viewModelType, new object[] { this, commandFilePath });

            // custom node loader
            string directory   = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string pluginsPath = Path.Combine(directory, "definitions");

            CustomNodeManager = new CustomNodeManager(pluginsPath);

            SearchViewModel = new SearchViewModel();

            dynSettings.PackageLoader = new PackageLoader();

            dynSettings.PackageLoader.DoCachedPackageUninstalls();
            dynSettings.PackageLoader.LoadPackages();

            FSchemeEnvironment = env;

            DynamoViewModel.Model.CurrentWorkspace.X = 0;
            DynamoViewModel.Model.CurrentWorkspace.Y = 0;

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

            DynamoLoader.ClearCachedAssemblies();
            DynamoLoader.LoadBuiltinTypes();

            //run tests
            if (FScheme.RunTests(DynamoLogger.Instance.Log))
            {
                DynamoLogger.Instance.Log("All Tests Passed. Core library loaded OK.");
            }

            this.InfoBubbleViewModel = new InfoBubbleViewModel();

            AddPythonBindings();

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