Пример #1
0
        protected override async Task <Result> InitializeInternal()
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.team = await this.GetTeam();

            this.participant = await this.GetParticipant();

            if (this.team != null && this.participant != null)
            {
                IEnumerable <ExtraLifeDonation> donations = (ChannelSession.Settings.ExtraLifeIncludeTeamDonations) ? await this.GetTeamDonations() : await this.GetParticipantDonations();

                foreach (ExtraLifeDonation donation in donations)
                {
                    if (!string.IsNullOrEmpty(donation.donationID))
                    {
                        donationsReceived[donation.donationID] = donation;
                    }
                }

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                AsyncRunner.RunAsyncBackground(this.BackgroundDonationCheck, this.cancellationTokenSource.Token, 60000);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

                this.TrackServiceTelemetry("ExtraLife");
                return(new Result());
            }
            return(new Result("Could not get Team/Participant data"));
        }
Пример #2
0
        protected override async Task <Result> InitializeInternal()
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.team = await this.GetTeam();

            this.participant = await this.GetParticipant();

            if (this.team != null && this.participant != null)
            {
                IEnumerable <ExtraLifeDonation> donations = (ChannelSession.Settings.ExtraLifeIncludeTeamDonations) ? await this.GetTeamDonations() : await this.GetParticipantDonations();

                foreach (ExtraLifeDonation donation in donations)
                {
                    if (!string.IsNullOrEmpty(donation.donationID))
                    {
                        donationsReceived[donation.donationID] = donation;
                    }
                }

                MixItUp.Base.Util.AsyncRunner.RunBackgroundTask(this.cancellationTokenSource.Token, 60000, this.BackgroundDonationCheck);

                this.TrackServiceTelemetry("ExtraLife");
                return(new Result());
            }
            return(new Result("Could not get Team/Participant data"));
        }