Esempio n. 1
0
        public void OpenPoll(clsPoll poll)
        {
            if (this.checkIfPollIsRunning())
            {
                return;
            }
            this.activePoll = poll;
            this.polltimer  = new Timer();

            if (poll.waitingForResultInSecounds == 0)
            {
                SendChatMessageEvent(poll.getPollString());
            }
            else if (poll.waitingForResultInSecounds > 30)
            {
                int intervall = poll.waitingForResultInSecounds - 30;
                polltimer.Interval = (intervall * 1000);  //umrechnen
                polltimer.Tick    += Polltimer_Tick_30SecoundsLeft;
                SendChatMessageEvent(poll.getPollString());
                polltimer.Start();
            }
            else if (poll.waitingForResultInSecounds > 15)
            {
                int intervall = poll.waitingForResultInSecounds - 15;
                polltimer.Interval = (intervall * 1000); //umrechnen
                polltimer.Tick    += Polltimer_Tick_10SecoundsLeft;
                SendChatMessageEvent(poll.getPollString());
                polltimer.Start();
            }
            else
            {
                polltimer.Interval = (poll.waitingForResultInSecounds * 1000); //umrechnen
                polltimer.Tick    += Polltimer_Tick_10SecoundsLeft;
                SendChatMessageEvent(poll.getPollString());
                polltimer.Start();
            }

            pollIsRunning = true;
        }