Пример #1
0
        public void OnConfigApply( Core.ConfigStorage Config )
        {
            PollSeconds = 10;
            History.Clear();
            string sec = Config.GetDefault(ConfigPrefix + ".COUNT.Seconds", "10");
            if (int.TryParse(sec, out PollSeconds)) {
            } else {
                PollSeconds = 10;
            }

            History.Clear();
            StreamerNick = Config.GetDefault(ConfigPrefix + ".TWITCHTVCOUNT.StreamerNick", "");
            if (!string.IsNullOrEmpty(StreamerNick)) {
                _CounterSource = CounterSource.Twitch;
                Header = "Twitch connecting, " + StreamerNick;
                return;
            }

            StreamerNick = Config.GetDefault(ConfigPrefix + ".CYBERTVCOUNT.StreamerNick", "");
            if (!string.IsNullOrEmpty(StreamerNick)) {
                _CounterSource = CounterSource.Cybergame;
                Header = "Cybergame connecting, " + StreamerNick;
                return;
            }
        }
Пример #2
0
        public void OnConfigApply( Core.ConfigStorage Config )
        {
            Result.Clear();
            Variants.Clear();
            PollExpire = null;
            IsVoteEnabled = true;

            Title = Config.GetDefault(ConfigPrefix + ".POLLING.Title", "").Trim();
            if (!string.IsNullOrEmpty(Title))
                Title += ". ";

            for (int j = 0; j < 4; ++j) {
                string txt = Config.GetDefault(ConfigPrefix + ".POLLING.Select" + (j + 1), "").Trim();
                string var = Config.GetDefault(ConfigPrefix + ".POLLING.Variant" + (j + 1), "").Trim();

                if (!string.IsNullOrEmpty(txt) && !string.IsNullOrEmpty(var)) {
                    Variants.Add(new Variant() {
                        Select = var,
                        Text = "(" + var + ") " + txt
                    });
                }
            }

            string min = Config.GetDefault(ConfigPrefix + ".POLLING.Minutes", "").Trim();
            int minutes;
            if (int.TryParse(min, out minutes)) {
                if (minutes == 0)
                    PollExpire = null;
                else
                    PollExpire = TimeSpan.FromMinutes(minutes);
            } else {
                PollExpire = null;
            }

            if (PollExpire == null) {
                Header = "Идет голосование";
            }

            PollTimer.Start();
            /// Автоматом, мы должны обновить вид.
        }