本文整理汇总了C#中fCraft.SchedulerTask.RunForever方法的典型用法代码示例。如果您正苦于以下问题:C# SchedulerTask.RunForever方法的具体用法?C# SchedulerTask.RunForever怎么用?C# SchedulerTask.RunForever使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.SchedulerTask
的用法示例。
在下文中一共展示了SchedulerTask.RunForever方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartTasks
void StartTasks() {
lock( taskLock ) {
updateTask = Scheduler.NewTask( UpdateTask );
updateTask.RunForever( this,
TimeSpan.FromMilliseconds( ConfigKey.TickInterval.GetInt() ),
TimeSpan.Zero );
if( ConfigKey.SaveInterval.GetInt() > 0 ) {
saveTask = Scheduler.NewBackgroundTask( SaveTask );
saveTask.IsCritical = true;
saveTask.AdjustForExecutionTime = true;
saveTask.RunForever( this,
TimeSpan.FromSeconds( ConfigKey.SaveInterval.GetInt() ),
TimeSpan.FromSeconds( ConfigKey.SaveInterval.GetInt() ) );
}
}
}
示例2: Start
public void Start()
{
started = true;
task = Scheduler.NewTask( StartFeed );
task.RunForever( TimeSpan.FromMilliseconds( 600 ) );
}
示例3: setBot
/// <summary>
/// Sets a bot, as well as the bot values. Must be called before any other bot classes.
/// </summary>
public void setBot(String botName, World botWorld, Position pos, int entityID)
{
Name = botName;
World = botWorld;
Position = pos;
ID = entityID;
thread = Scheduler.NewTask(t => NetworkLoop());
thread.RunForever(TimeSpan.FromSeconds(0.1));//run the network loop every 0.1 seconds
Server.Bots.Add(this);
}
示例4: StartTasks
internal void StartTasks() {
lock( taskLock ) {
updateTask = Scheduler.NewTask( UpdateTask );
updateTask.RunForever( this,
TimeSpan.FromMilliseconds( ConfigKey.TickInterval.GetInt() ),
TimeSpan.Zero );
if( ConfigKey.SaveInterval.GetInt() > 0 ) {
saveTask = Scheduler.NewTask( SaveTask );
saveTask.RunForever( this,
TimeSpan.FromSeconds( ConfigKey.SaveInterval.GetInt() ),
TimeSpan.FromSeconds( ConfigKey.SaveInterval.GetInt() ) );
}
if( ConfigKey.BackupInterval.GetInt() > 0 ) {
backupTask = Scheduler.NewTask( BackupTask );
TimeSpan interval = TimeSpan.FromMinutes( ConfigKey.BackupInterval.GetInt() );
backupTask.RunForever( this,
interval,
(ConfigKey.BackupOnStartup.GetBool() ? TimeSpan.Zero : interval) );
}
}
}