当前位置: 首页>>代码示例>>C#>>正文


C# DynamoScheduler.Shutdown方法代码示例

本文整理汇总了C#中Dynamo.Core.Threading.DynamoScheduler.Shutdown方法的典型用法代码示例。如果您正苦于以下问题:C# DynamoScheduler.Shutdown方法的具体用法?C# DynamoScheduler.Shutdown怎么用?C# DynamoScheduler.Shutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dynamo.Core.Threading.DynamoScheduler的用法示例。


在下文中一共展示了DynamoScheduler.Shutdown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestUpdateGraphyAsyncTaskMerge

        public void TestUpdateGraphyAsyncTaskMerge()
        {
            // Verify a UpdateGraphAysncTask can't be merged with the other one
            // if they modifiy different nodes.
            OpenModel(TestDirectory + @"\core\scheduler\simple.dyn");

            var cbn = CurrentDynamoModel.CurrentWorkspace.Nodes.OfType<CodeBlockNodeModel>().FirstOrDefault();
            var funcNode = CurrentDynamoModel.CurrentWorkspace.Nodes.OfType<DSFunction>().FirstOrDefault();

            // Keep code block node be silent so that the graph won't be
            // executed automatically
            cbn.RaisesModificationEvents = false;

            var elementResolver = CurrentDynamoModel.CurrentWorkspace.ElementResolver;
            cbn.SetCodeContent("-22", elementResolver); // Invalid numeric value.
            cbn.MarkNodeAsModified();

            // Get a UpdateGrapyAsyncTask for the modification of cbn
            var scheduler = new DynamoScheduler(new SampleSchedulerThread(), true);
            UpdateGraphAsyncTask task1 = new UpdateGraphAsyncTask(scheduler, false);
            task1.Initialize(CurrentDynamoModel.EngineController, CurrentDynamoModel.CurrentWorkspace);

            // Get a UpdateGraphAsyncTask for the modification of Math.Sin()
            funcNode.MarkNodeAsModified();
            UpdateGraphAsyncTask task2 = new UpdateGraphAsyncTask(scheduler, false);
            task2.Initialize(CurrentDynamoModel.EngineController, CurrentDynamoModel.CurrentWorkspace);

            // And both async tasks should be kept.
            var mergeResult = task1.CanMergeWith(task2);
            Assert.AreEqual(AsyncTask.TaskMergeInstruction.KeepBoth, mergeResult);

            mergeResult = task2.CanMergeWith(task1);
            Assert.AreEqual(AsyncTask.TaskMergeInstruction.KeepBoth, mergeResult);

            scheduler.Shutdown();
        }
开发者ID:dspeckhard,项目名称:Dynamo,代码行数:36,代码来源:SchedulerTests.cs

示例2: TestSchedulerCreationDestruction

        public void TestSchedulerCreationDestruction()
        {
            var schedulerThread = new SampleSchedulerThread();
            Assert.IsFalse(schedulerThread.Initialized);
            Assert.IsFalse(schedulerThread.Destroyed);

            var scheduler = new DynamoScheduler(schedulerThread, false);
            Assert.IsTrue(schedulerThread.Initialized);
            Assert.IsFalse(schedulerThread.Destroyed);

            scheduler.Shutdown();
            Assert.IsTrue(schedulerThread.Initialized);
            Assert.IsTrue(schedulerThread.Destroyed);
        }
开发者ID:qingemeng,项目名称:Dynamo,代码行数:14,代码来源:SchedulerTests.cs

示例3: TestSchedulerCreationDestruction

        public void TestSchedulerCreationDestruction()
        {
            var schedulerThread = new SampleSchedulerThread();
            Assert.IsFalse(schedulerThread.Initialized);
            Assert.IsFalse(schedulerThread.Destroyed);

            var scheduler = new DynamoScheduler(schedulerThread, TaskProcessMode.Asynchronous);
            Assert.IsTrue(schedulerThread.Initialized);
            Assert.IsFalse(schedulerThread.Destroyed);

            scheduler.Shutdown();
            Assert.IsTrue(schedulerThread.Initialized);
            Assert.IsTrue(schedulerThread.Destroyed);
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:14,代码来源:SchedulerTests.cs


注:本文中的Dynamo.Core.Threading.DynamoScheduler.Shutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。