NewBackgroundTask() public static method

Creates a new SchedulerTask object to run in the background thread. Use this if your task is not very time-sensitive or frequent, or if your callback is resource-intensive.
public static NewBackgroundTask ( [ callback ) : SchedulerTask
callback [ Method to call when the task is triggered.
return SchedulerTask
Example #1
0
 /// <summary> Begins to asynchronously check player's account type. </summary>
 public void CheckAccountType()
 {
     if (AccountType != AccountType.Paid)
     {
         Scheduler.NewBackgroundTask(CheckPaidStatusCallback).RunOnce(this, TimeSpan.Zero);
     }
 }
Example #2
0
 internal static void Init()
 {
     Paths.TestDirectory("BlockDB", Paths.BlockDBPath, true);
     Player.PlacedBlock += OnPlayerPlacedBlock;
     Scheduler.NewBackgroundTask(FlushAll).RunForever(FlushInterval, FlushInterval);
     IsEnabledGlobally = true;
 }
Example #3
0
        //init
        public static void Load()
        {
            Player.PlacingBlock += PlantPhysics.blockSquash;
            SchedulerTask drownCheck = Scheduler.NewBackgroundTask(WaterPhysics.drownCheck).RunForever(TimeSpan.FromSeconds(3));

            Player.PlacingBlock += PlayerPlacingPhysics;
        }
Example #4
0
 internal static void Start()
 {
     Scheduler.NewBackgroundTask(Beat).RunForever(Delay);
     if (ConfigKey.HeartbeatToWoMDirect.Enabled() && ConfigKey.IsPublic.Enabled())
     {
         Logger.Log(LogType.SystemActivity,
                    "WoM Direct heartbeat is enabled. Your server will be listed on http://direct.worldofminecraft.com");
     }
 }
Example #5
0
 public Bot(string name, Position pos, int iD, World world_)
 {
     Name      = name; //bots should be gray :P
     Pos       = pos;
     ID        = iD;
     world     = world_;
     _isMoving = true;
     SetBot();
     Scheduler.NewBackgroundTask(t => StartNewAIMovement()).RunForever(TimeSpan.FromMilliseconds(500));
 }
Example #6
0
        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.RunForever( this,
                                         TimeSpan.FromSeconds( ConfigKey.SaveInterval.GetInt() ),
                                         TimeSpan.FromSeconds( ConfigKey.SaveInterval.GetInt() ) );
                }
            }
        }
Example #7
0
 internal static void StartSaveTask()
 {
     saveTask = Scheduler.NewBackgroundTask(SaveTask)
                .RunForever(SaveInterval, SaveInterval + TimeSpan.FromSeconds(15));
 }
Example #8
0
 internal static void Start()
 {
     Scheduler.NewBackgroundTask(Beat).RunForever(Delay);
 }
Example #9
0
 /// <summary> Starts the heartbeats. </summary>
 public static void Start()
 {
     task = Scheduler.NewBackgroundTask(Beat).RunManual();
 }