RunForever() private method

private RunForever ( ) : SchedulerTask
return SchedulerTask
Esempio n. 1
0
        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));
                }
            }
        }
Esempio n. 2
0
        public List <Vector3I> PositionList = new List <Vector3I>(); //Vectors in this list are connected, but not neccessarily in a line

        #region Public Methods

        /// <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);
        }
Esempio n. 3
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() ) );
                }
            }
        }
Esempio n. 4
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.IsCritical = true;
                    saveTask.AdjustForExecutionTime = true;
                    saveTask.RunForever( this,
                                         TimeSpan.FromSeconds( ConfigKey.SaveInterval.GetInt() ),
                                         TimeSpan.FromSeconds( ConfigKey.SaveInterval.GetInt() ) );
                }
            }
        }
Esempio n. 5
0
 internal static void StartSaveTask()
 {
     saveTask            = Scheduler.NewBackgroundTask(SaveTask);
     saveTask.IsCritical = true;
     saveTask.RunForever(SaveInterval, SaveInterval + TimeSpan.FromSeconds(15));
 }
Esempio n. 6
0
 public void Start()
 {
     started = true;
     task    = Scheduler.NewTask(StartFeed);
     task.RunForever(TimeSpan.FromMilliseconds(600));
 }
Esempio n. 7
0
        /// <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);
        }
Esempio n. 8
0
 public void Start()
 {
     started = true;
     task = Scheduler.NewTask( StartFeed );
     task.RunForever( TimeSpan.FromMilliseconds( 600 ) );
 }
Esempio n. 9
0
        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) );
                }
            }
        }