本文整理汇总了C#中Dynamo.Core.Threading.DynamoScheduler类的典型用法代码示例。如果您正苦于以下问题:C# DynamoScheduler类的具体用法?C# DynamoScheduler怎么用?C# DynamoScheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DynamoScheduler类属于Dynamo.Core.Threading命名空间,在下文中一共展示了DynamoScheduler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TimeStampGenerator00
public void TimeStampGenerator00()
{
var scheduler = new DynamoScheduler(new SampleSchedulerThread());
Assert.AreEqual(1024, scheduler.NextTimeStamp.Identifier);
Assert.AreEqual(1025, scheduler.NextTimeStamp.Identifier);
Assert.AreEqual(1026, scheduler.NextTimeStamp.Identifier);
}
开发者ID:jbenoit44,项目名称:Dynamo,代码行数:7,代码来源:SchedulerTests.cs
示例2: AsyncTask
/// <summary>
/// Constructs an instance of AsyncTask object.
/// </summary>
/// <param name="scheduler">A reference to the DynamoScheduler, this
/// parameter cannot be null.</param>
///
protected AsyncTask(DynamoScheduler scheduler)
{
if (scheduler == null)
throw new ArgumentNullException("scheduler");
this.scheduler = scheduler;
CreationTime = scheduler.NextTimeStamp;
}
开发者ID:jbenoit44,项目名称:Dynamo,代码行数:14,代码来源:AsyncTask.cs
示例3: AsyncTask
/// <summary>
/// Constructs an instance of AsyncTask object.
/// </summary>
/// <param name="scheduler">A reference to the DynamoScheduler, this
/// parameter cannot be null.</param>
/// <param name="callback">A delegate to be invoked when the AsyncTask
/// completes asynchronously. This parameter is optional.</param>
///
protected AsyncTask(DynamoScheduler scheduler, Action<AsyncTask> callback)
{
if (scheduler == null)
throw new ArgumentNullException("scheduler");
this.scheduler = scheduler;
this.callback = callback;
CreationTime = scheduler.NextTimeStamp;
}
开发者ID:RobertiF,项目名称:Dynamo,代码行数:17,代码来源:AsyncTask.cs
示例4: Initialize
public void Initialize(DynamoScheduler owningScheduler)
{
scheduler = owningScheduler;
internalThread = new Thread(ThreadProc)
{
IsBackground = true,
Name = "DynamoSchedulerThread"
};
internalThread.Start();
}
开发者ID:whztt07,项目名称:Dynamo,代码行数:11,代码来源:SchedulerThread.cs
示例5: DynamoModel
protected DynamoModel(IStartConfiguration config)
{
ClipBoard = new ObservableCollection<ModelBase>();
pathManager = new PathManager(new PathManagerParams
{
CorePath = config.DynamoCorePath,
PathResolver = config.PathResolver
});
// Ensure we have all directories in place.
var exceptions = new List<Exception>();
pathManager.EnsureDirectoryExistence(exceptions);
Context = config.Context;
IsTestMode = config.StartInTestMode;
DebugSettings = new DebugSettings();
Logger = new DynamoLogger(DebugSettings, pathManager.LogDirectory);
foreach (var exception in exceptions)
{
Logger.Log(exception); // Log all exceptions.
}
MigrationManager = new MigrationManager(DisplayFutureFileMessage, DisplayObsoleteFileMessage);
MigrationManager.MessageLogged += LogMessage;
MigrationManager.MigrationTargets.Add(typeof(WorkspaceMigrations));
var thread = config.SchedulerThread ?? new DynamoSchedulerThread();
Scheduler = new DynamoScheduler(thread, IsTestMode ? TaskProcessMode.Synchronous : TaskProcessMode.Asynchronous);
Scheduler.TaskStateChanged += OnAsyncTaskStateChanged;
geometryFactoryPath = config.GeometryFactoryPath;
IPreferences preferences = CreateOrLoadPreferences(config.Preferences);
var settings = preferences as PreferenceSettings;
if (settings != null)
{
PreferenceSettings = settings;
PreferenceSettings.PropertyChanged += PreferenceSettings_PropertyChanged;
}
InitializePreferences(preferences);
InitializeInstrumentationLogger();
if (!isTestMode && this.PreferenceSettings.IsFirstRun)
{
DynamoMigratorBase migrator = null;
try
{
migrator = DynamoMigratorBase.MigrateBetweenDynamoVersions(pathManager, config.PathResolver);
}
catch (Exception e)
{
Logger.Log(e.Message);
}
if (migrator != null)
{
var isFirstRun = this.PreferenceSettings.IsFirstRun;
this.PreferenceSettings = migrator.PreferenceSettings;
// Preserve the preference settings for IsFirstRun as this needs to be set
// only by UsageReportingManager
this.PreferenceSettings.IsFirstRun = isFirstRun;
}
}
// At this point, pathManager.PackageDirectories only has 1 element which is the directory
// in AppData. If list of PackageFolders is empty, add the folder in AppData to the list since there
// is no additional location specified. Otherwise, update pathManager.PackageDirectories to include
// PackageFolders
if (PreferenceSettings.CustomPackageFolders.Count == 0)
PreferenceSettings.CustomPackageFolders = new List<string> {pathManager.UserDataDirectory};
else
pathManager.LoadCustomPackageFolders(PreferenceSettings.CustomPackageFolders);
SearchModel = new NodeSearchModel();
SearchModel.ItemProduced +=
node => ExecuteCommand(new CreateNodeCommand(node, 0, 0, true, true));
NodeFactory = new NodeFactory();
NodeFactory.MessageLogged += LogMessage;
CustomNodeManager = new CustomNodeManager(NodeFactory, MigrationManager);
InitializeCustomNodeManager();
extensionManager = new ExtensionManager();
extensionManager.MessageLogged += LogMessage;
var extensions = config.Extensions ?? ExtensionManager.ExtensionLoader.LoadDirectory(pathManager.ExtensionsDirectory);
Loader = new NodeModelAssemblyLoader();
Loader.MessageLogged += LogMessage;
// Create a core which is used for parsing code and loading libraries
var libraryCore =
new ProtoCore.Core(new Options { RootCustomPropertyFilterPathName = string.Empty });
//.........这里部分代码省略.........
开发者ID:xconverge,项目名称:Dynamo,代码行数:101,代码来源:DynamoModel.cs
示例6: HomeWorkspaceModel
public HomeWorkspaceModel(
EngineController engine,
DynamoScheduler scheduler,
NodeFactory factory,
IEnumerable<KeyValuePair<Guid, List<string>>> traceData,
IEnumerable<NodeModel> e,
IEnumerable<NoteModel> n,
IEnumerable<AnnotationModel> a,
IEnumerable<PresetModel> presets,
ElementResolver resolver,
WorkspaceInfo info,
bool verboseLogging,
bool isTestMode)
: base(e, n,a, info, factory,presets, resolver)
{
EvaluationCount = 0;
// This protects the user from a file that might have crashed during
// its last run. As a side effect, this also causes all files set to
// run auto but lacking the HasRunWithoutCrash flag to run manually.
if (info.RunType == RunType.Automatic && !info.HasRunWithoutCrash)
{
info.RunType = RunType.Manual;
}
RunSettings = new RunSettings(info.RunType, info.RunPeriod);
PreloadedTraceData = traceData;
this.scheduler = scheduler;
this.verboseLogging = verboseLogging;
IsTestMode = isTestMode;
EngineController = engine;
// The first time the preloaded trace data is set, we cache
// the data as historical. This will be used after the initial
// run of this workspace, when the PreloadedTraceData has been
// nulled, to check for node deletions and reconcile the trace data.
// We do a deep copy of this data because the PreloadedTraceData is
// later set to null before the graph update.
var copiedData = new List<KeyValuePair<Guid, List<string>>>();
foreach (var kvp in PreloadedTraceData)
{
var strings = kvp.Value.Select(string.Copy).ToList();
copiedData.Add(new KeyValuePair<Guid, List<string>>(kvp.Key, strings));
}
historicalTraceData = copiedData;
}
开发者ID:joespiff,项目名称:Dynamo,代码行数:49,代码来源:HomeWorkspaceModel.cs
示例7: UpdateRenderPackageAsyncTask
internal UpdateRenderPackageAsyncTask(DynamoScheduler scheduler)
: base(scheduler)
{
nodeGuid = Guid.Empty;
renderPackages = new List<IRenderPackage>();
}
开发者ID:whztt07,项目名称:Dynamo,代码行数:6,代码来源:UpdateRenderPackageAsyncTask.cs
示例8: UpdateGraphAsyncTask
internal UpdateGraphAsyncTask(DynamoScheduler scheduler)
: base(scheduler)
{
}
开发者ID:whztt07,项目名称:Dynamo,代码行数:4,代码来源:UpdateGraphAsyncTask.cs
示例9: SetTraceDataAsyncTask
internal SetTraceDataAsyncTask(DynamoScheduler scheduler)
: base(scheduler)
{
}
开发者ID:whztt07,项目名称:Dynamo,代码行数:4,代码来源:SetTraceDataAsyncTask.cs
示例10: GrabTimeStamp
internal void GrabTimeStamp(DynamoScheduler scheduler)
{
// Get the time-stamp value from the scheduler.
this.TimeStampValue = scheduler.NextTimeStamp;
this.doneEvent.Set(); // Done with grabbing.
}
开发者ID:qingemeng,项目名称:Dynamo,代码行数:6,代码来源:SchedulerTests.cs
示例11: ErrorProneAsyncTask
internal ErrorProneAsyncTask(DynamoScheduler scheduler, int value)
: base(scheduler)
{
Value = value;
}
开发者ID:qingemeng,项目名称:Dynamo,代码行数:5,代码来源:SchedulerTests.cs
示例12: InconsequentialAsyncTask
internal InconsequentialAsyncTask(DynamoScheduler scheduler, int punch)
: base(scheduler)
{
Punch = punch;
}
开发者ID:qingemeng,项目名称:Dynamo,代码行数:5,代码来源:SchedulerTests.cs
示例13: PrioritizedAsyncTask
internal PrioritizedAsyncTask(DynamoScheduler scheduler, int priority)
: base(scheduler)
{
CurrPriority = priority; // Assign task priority.
}
开发者ID:qingemeng,项目名称:Dynamo,代码行数:5,代码来源:SchedulerTests.cs
示例14: DelegateBasedAsyncTask
internal DelegateBasedAsyncTask(DynamoScheduler scheduler, Action<AsyncTask> callback)
: base(scheduler, callback)
{
}
开发者ID:RobertiF,项目名称:Dynamo,代码行数:4,代码来源:DelegateBasedAsyncTask.cs
示例15: CompileCustomNodeAsyncTask
internal CompileCustomNodeAsyncTask(DynamoScheduler scheduler)
: base(scheduler)
{
}
开发者ID:whztt07,项目名称:Dynamo,代码行数:4,代码来源:CompileCustomNodeAsyncTask.cs
示例16: OnTaskStateChanged
internal void OnTaskStateChanged(
DynamoScheduler scheduler,
TaskStateChangedEventArgs e)
{
AddToResultList(e.Task.ToString(), e.CurrentState);
}
开发者ID:qingemeng,项目名称:Dynamo,代码行数:6,代码来源:SchedulerTests.cs
示例17: ProcessPendingCustomNodeSyncData
/// <summary>
/// DynamoModel calls this method prior to scheduling a graph update for
/// the home workspace. This method is called to schedule custom node
/// compilation since the home workspace update may depend on it. Any
/// updates to a CustomNodeDefinition will cause GraphSyncData to be added
/// to "pendingCustomNodeSyncData" queue.
/// </summary>
/// <param name="scheduler">The scheduler on which custom node compilation
/// task can be scheduled.</param>
///
internal void ProcessPendingCustomNodeSyncData(DynamoScheduler scheduler)
{
while (pendingCustomNodeSyncData.Count > 0)
{
var initParams = new CompileCustomNodeParams()
{
SyncData = pendingCustomNodeSyncData.Dequeue(),
EngineController = this
};
var compileTask = new CompileCustomNodeAsyncTask(scheduler);
if (compileTask.Initialize(initParams))
scheduler.ScheduleForExecution(compileTask);
}
}
开发者ID:whztt07,项目名称:Dynamo,代码行数:25,代码来源:EngineController.cs
示例18: TimeStampGenerator01
public void TimeStampGenerator01()
{
const int EventCount = 16;
var events = new ManualResetEvent[EventCount];
var grabbers = new TimeStampGrabber[EventCount];
// Initialize events and time stamp grabbers.
for (int index = 0; index < EventCount; ++index)
{
events[index] = new ManualResetEvent(false);
grabbers[index] = new TimeStampGrabber(events[index]);
}
// Start all time-stamp grabbers "at one go".
var scheduler = new DynamoScheduler(new SampleSchedulerThread(), true);
Parallel.For(0, EventCount, ((index) =>
{
grabbers[index].GrabTimeStamp(scheduler);
}));
WaitHandle.WaitAll(events);
var values = new List<TimeStamp>();
for (int index = 0; index < EventCount; ++index)
values.Add(grabbers[index].TimeStampValue);
// Ensure we get a list of time stamps, and that these numbers are
// all unique (i.e. the distinct set of numbers returned should have
// the same count as the original list).
//
Assert.AreEqual(EventCount, values.Count);
var distinct = values.Distinct();
Assert.AreEqual(values.Count, distinct.Count());
}
开发者ID:qingemeng,项目名称:Dynamo,代码行数:33,代码来源:SchedulerTests.cs
示例19: SetTraceDataAsyncTask
internal SetTraceDataAsyncTask(DynamoScheduler scheduler, Action<AsyncTask> callback)
: base(scheduler, callback)
{
}
开发者ID:RobertiF,项目名称:Dynamo,代码行数:4,代码来源:SetTraceDataAsyncTask.cs
示例20: 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
注:本文中的Dynamo.Core.Threading.DynamoScheduler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论