Example #1
0
 public void CancelVoting()
 {
     if (votingScope != null)
     {
         bot.RemoveInteractiveScope(votingScope.Name);
     }
     foreach (var resultEvent in voting.ResultEvents)
     {
         resultEvent.InvokeEvent(bot, voting);
     }
     votingScope = null;
     voting      = null;
 }
Example #2
0
        public void StartVoting(VotingPattern pattern)
        {
            //CreateFakeVoting();
            CreateVoting(pattern);
            votingScope = new VotingScope {
                voting = this.voting, Name = VotingScopeName
            };
            var strBuilder = new StringBuilder(Drawer).Append(voting.ObjectOfVoting)
                             .Append(sDrawer).Append("Варианты:").Append(sDrawer);

            for (int i = 1; i < voting.Options.Count; i++)
            {
                var opt = voting.Options.ElementAt(i);
                strBuilder.Append(i + ")").Append(opt.Value).Append(" - ").Append(opt.Key).Append(sDrawer);
            }
            bot.AddInteractiveScope(votingScope.Name, votingScope);
            bot.SendMessage(Drawer + " " + strBuilder);
        }