本文整理匯總了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) );
}
}
}