Exemple #1
0
        int timeoutTime = 5;//In minuites

        public ShowMovieSuggestions(SocketGuild guild, ISocketMessageChannel channel, bool showWatched)
        {
            this.channel     = channel;
            this.guild       = guild;
            serverData       = ServerData.Get(guild);
            this.showWatched = showWatched;
            Program.SubscribeToReactionRemoved(Action);
            Program.SubscribeToReactionAdded(Action);
            totalPages = showWatched ? serverData.GetWatchedMovies().Count() : serverData.GetSuggestedMovies().Count();
            totalPages = (int)Math.Ceiling(totalPages / (float)pageSize);
            pageNumber = Math.Min(totalPages - 1, pageNumber);
            AutoResetEvent autoEvent = new AutoResetEvent(false);

            expirationTimer = new Timer(OnExpire, autoEvent, 1000 * 60 * timeoutTime, Timeout.Infinite);
            Program.Instance.OnMoviesListModified += OnMoviesModified;
        }
Exemple #2
0
        public RankedServerVote(SocketGuild guild, Movie[] movieOptions, ISocketMessageChannel channel)
        {
            this.associatedGuild = guild;
            this.channel         = channel;
            voters            = new Dictionary <ulong, List <int> >();
            this.movieOptions = movieOptions;
            Program.SubscribeToReactionAdded(ReactCallback);
            Program.SubscribeToReactionRemoved(UnReactCallback);
            //ServerData data = ServerData.Get(guild);
            //maxUserVotes = MoviesData.Model.GetVoteCount(guild);
            ballotItems = new BallotItem[movieOptions.Length];
            serverData  = ServerData.Get(guild);

            for (int i = 0; i < ballotItems.Length; i++)
            {
                ballotItems[i]       = new BallotItem();
                ballotItems[i].movie = movieOptions[i];
                ballotItems[i].votes = 0;
                ballotItems[i].score = 0;
            }
        }