fCraft.ChatTimer.Stop C# (CSharp) Method

Stop() public method

public Stop ( ) : void
return void
        public void Stop() {
            IsRunning = false;
            task.Stop();
            RemoveTimerFromList( this );
        }

Same methods

ChatTimer::Stop ( bool aborted ) : void

Usage Example

Example #1
0
        static void TimerCallback([NotNull] SchedulerTask task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }
            ChatTimer timer = (ChatTimer)task.UserState;

            if (task.MaxRepeats == 1)
            {
                if (String.IsNullOrEmpty(timer.Message))
                {
                    Chat.SendSay(Player.Console, "(Timer Up)");
                }
                else
                {
                    Chat.SendSay(Player.Console, "(Timer Up) " + timer.Message);
                }
                timer.Stop(false);
            }
            else if (timer.announceIntervalIndex >= 0)
            {
                if (timer.lastHourAnnounced != (int)timer.TimeLeft.TotalHours)
                {
                    timer.lastHourAnnounced = (int)timer.TimeLeft.TotalHours;
                    timer.Announce(TimeSpan.FromHours(Math.Ceiling(timer.TimeLeft.TotalHours)));
                }
                if (timer.TimeLeft <= AnnounceIntervals[timer.announceIntervalIndex])
                {
                    timer.Announce(AnnounceIntervals[timer.announceIntervalIndex]);
                    timer.announceIntervalIndex--;
                }
            }
        }
All Usage Examples Of fCraft.ChatTimer::Stop