Example #1
0
        public TestPathResolver(TestPathResolverParams resolverParams)
        {
            additionalResolutionPaths = new HashSet<string>();
            additionalNodeDirectories = new HashSet<string>();
            preloadedLibraryPaths = new HashSet<string>();

            userDataRootFolder = resolverParams.UserDataRootFolder;
            commonDataRootFolder = resolverParams.CommonDataRootFolder;
        }
Example #2
0
        public TestPathResolver(TestPathResolverParams resolverParams)
        {
            additionalResolutionPaths = new HashSet <string>();
            additionalNodeDirectories = new HashSet <string>();
            preloadedLibraryPaths     = new HashSet <string>();

            userDataRootFolder   = resolverParams.UserDataRootFolder;
            commonDataRootFolder = resolverParams.CommonDataRootFolder;
        }
        protected void StartDynamo()
        {
            var assemblyPath = Assembly.GetExecutingAssembly().Location;
            preloader = new Preloader(Path.GetDirectoryName(assemblyPath));
            preloader.Preload();

            TestPathResolver pathResolver = null;
            var preloadedLibraries = new List<string>();
            GetLibrariesToPreload(preloadedLibraries);

            if (preloadedLibraries.Any())
            {
                // Only when any library needs preloading will a path resolver be 
                // created, otherwise DynamoModel gets created without preloading 
                // any library.
                // 

                var pathResolverParams = new TestPathResolverParams()
                {
                    UserDataRootFolder = GetUserUserDataRootFolder(),
                    CommonDataRootFolder = GetCommonDataRootFolder()
                };

                pathResolver = new TestPathResolver(pathResolverParams);
                foreach (var preloadedLibrary in preloadedLibraries.Distinct())
                {
                    pathResolver.AddPreloadLibraryPath(preloadedLibrary);
                }
            }

            var model = DynamoModel.Start(
                new DynamoModel.DefaultStartConfiguration()
                {
                    PathResolver = pathResolver,
                    StartInTestMode = true,
                    GeometryFactoryPath = preloader.GeometryFactoryPath,
                    ProcessMode = Core.Threading.TaskProcessMode.Synchronous
                });

            var watch3DViewParams = new Watch3DViewModelStartupParams(model);
            this.ViewModel = DynamoViewModel.Start(
                new DynamoViewModel.StartConfiguration()
                {
                    DynamoModel = model,
                    Watch3DViewModel = new DefaultWatch3DViewModel(watch3DViewParams)
                });

            this.ViewModel.RequestUserSaveWorkflow += RequestUserSaveWorkflow;
        }