DCT.UI.CoreUI.Countdown C# (CSharp) Method

Countdown() private method

private Countdown ( AttackingType type ) : void
type AttackingType
return void
        internal void Countdown(AttackingType type)
        {
            // pass to UI thread
            if (InvokeRequired)
            {
                Invoke(new CountdownHandler(Countdown), type);
                return;
            }

            // check stopafter conditions
            if (Settings.StopAfter)
            {
                switch (Settings.StopAfterMode)
                {
                    case UserEditable.StopAfterType.Minutes:
                        if (MainPanel.StopAfterTimeFinished)
                        {
                            LogPanel.Log(string.Format("Reached time limit of {0} minutes", Settings.StopAfterVal));
                            MainPanel.StopAfterFinish();
                            StopAttacking(true);
                            return;
                        }
                        break;
                    case UserEditable.StopAfterType.Runs:
                        MainPanel.StopAfterCounter++;
                        if (MainPanel.StopAfterCounterFinished)
                        {
                            LogPanel.Log(string.Format("Reached {0} runs", Settings.StopAfterVal));
                            MainPanel.StopAfterFinish();
                            StopAttacking(true);
                            return;
                        }
                        break;
                }
            }

            // timer setup
            int countFor;
            if (Settings.UseCountdownTimer)
            {
                countFor = (MainPanel.CountdownValue) * 60;
            }
            else
            {
                countFor = SecondsUntilHour();
            }

            mCountdownTimer = new CountDownTimer(countFor);

            mCountdownTimer.Interval = 1000;
            mCountdownTimer.Tick += t_Tick;
            mCountdownTimer.Started += t_Started;
            mCountdownTimer.Stopped += t_Stopped;
            mCountdownType = type;

            mCountdownTimer.Start();

            if (Settings.ClearLogs)
                LogPanel.ClearMost();
        }
CoreUI