本文整理汇总了C#中Dynamo.Core.Threading.DynamoScheduler类的典型用法代码示例。如果您正苦于以下问题:C# DynamoScheduler类的具体用法?C# DynamoScheduler怎么用?C# DynamoScheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DynamoScheduler类属于Dynamo.Core.Threading命名空间,在下文中一共展示了DynamoScheduler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例4: Initialize
public void Initialize(DynamoScheduler owningScheduler)
{
scheduler = owningScheduler;
internalThread = new Thread(ThreadProc)
{
IsBackground = true,
Name = "DynamoSchedulerThread"
};
internalThread.Start();
}
示例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 });
//.........这里部分代码省略.........
示例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;
}
示例7: UpdateRenderPackageAsyncTask
internal UpdateRenderPackageAsyncTask(DynamoScheduler scheduler)
: base(scheduler)
{
nodeGuid = Guid.Empty;
renderPackages = new List<IRenderPackage>();
}
示例8: UpdateGraphAsyncTask
internal UpdateGraphAsyncTask(DynamoScheduler scheduler)
: base(scheduler)
{
}
示例9: SetTraceDataAsyncTask
internal SetTraceDataAsyncTask(DynamoScheduler scheduler)
: base(scheduler)
{
}
示例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.
}
示例11: ErrorProneAsyncTask
internal ErrorProneAsyncTask(DynamoScheduler scheduler, int value)
: base(scheduler)
{
Value = value;
}
示例12: InconsequentialAsyncTask
internal InconsequentialAsyncTask(DynamoScheduler scheduler, int punch)
: base(scheduler)
{
Punch = punch;
}
示例13: PrioritizedAsyncTask
internal PrioritizedAsyncTask(DynamoScheduler scheduler, int priority)
: base(scheduler)
{
CurrPriority = priority; // Assign task priority.
}
示例14: DelegateBasedAsyncTask
internal DelegateBasedAsyncTask(DynamoScheduler scheduler, Action<AsyncTask> callback)
: base(scheduler, callback)
{
}
示例15: CompileCustomNodeAsyncTask
internal CompileCustomNodeAsyncTask(DynamoScheduler scheduler)
: base(scheduler)
{
}