예제 #1
0
 public bool AddToSearch(SearchModel search)
 {
     return
         search.Add(new CustomNodeInfo(  FunctionId, 
                                         WorkspaceModel.Name,
                                         WorkspaceModel.Category,
                                         WorkspaceModel.Description,
                                         WorkspaceModel.FileName ));
 }
예제 #2
0
        internal SearchViewModel(DynamoViewModel dynamoViewModel, SearchModel Model)
        {
            this.Model = Model;
            this.dynamoViewModel = dynamoViewModel;

            InitializeCore();
        }
예제 #3
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);
        }
예제 #4
0
 public void Init()
 {
     model = new SearchModel();
     viewModel = new SearchViewModel(null, model);
 }
예제 #5
0
        public void CanRunRemoveCategoryIfCategoryDoesntExist()
        {
            var search = new SearchModel();
            search.AddCategory("Peter.Boyer");

            search.RemoveCategory("Peter.Rabbit");
            Assert.IsNull(search.GetCategoryByName("Peter.Rabbit"));

        }
예제 #6
0
        /// <summary>
        /// Helper method for custom node adding and removing
        /// </summary>
        public static void AssertAddAndRemoveCustomNode(SearchModel searchModel, string nodeName, string catName, string descr = "Bla",
                                                 string path = "Bla")
        {
            var dummyInfo = new CustomNodeInfo(Guid.NewGuid(), nodeName, catName, descr, path);

            searchModel.Add(dummyInfo);

            var res = searchModel.Search(nodeName).ToList();
            Assert.AreNotEqual(0, res.Count());
            Assert.AreEqual(res[0].Name, nodeName);
            Assert.IsTrue(searchModel.ContainsCategory(catName));

            searchModel.RemoveNodeAndEmptyParentCategory(nodeName);
            res = searchModel.Search(nodeName).ToList();

            Assert.AreEqual(0, res.Count());
            Assert.IsFalse(searchModel.ContainsCategory(catName));
        }
예제 #7
0
 public void Init()
 {
    search = new SearchModel();
 }