RunForever() private méthode

private RunForever ( ) : SchedulerTask
Résultat SchedulerTask
Exemple #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));
                }
            }
        }
Exemple #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);
        }
        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() ) );
                }
            }
        }
Exemple #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() ) );
                }
            }
        }
 internal static void StartSaveTask()
 {
     saveTask            = Scheduler.NewBackgroundTask(SaveTask);
     saveTask.IsCritical = true;
     saveTask.RunForever(SaveInterval, SaveInterval + TimeSpan.FromSeconds(15));
 }
Exemple #6
0
 public void Start()
 {
     started = true;
     task    = Scheduler.NewTask(StartFeed);
     task.RunForever(TimeSpan.FromMilliseconds(600));
 }
Exemple #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);
        }
Exemple #8
0
 public void Start()
 {
     started = true;
     task = Scheduler.NewTask( StartFeed );
     task.RunForever( TimeSpan.FromMilliseconds( 600 ) );
 }
Exemple #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) );
                }
            }
        }