コード例 #1
0
        protected override async Task <Result> InitializeInternal()
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.startTime = DateTimeOffset.Now;

            this.user = await this.GetCurrentAccount();

            if (this.user != null)
            {
                if (!string.IsNullOrEmpty(ChannelSession.Settings.JustGivingPageShortName))
                {
                    IEnumerable <JustGivingFundraiser> fundraisers = await this.GetCurrentFundraisers();

                    this.fundraiser = fundraisers.FirstOrDefault(f => f.pageShortName.Equals(ChannelSession.Settings.JustGivingPageShortName));
                }

#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("JustGiving");
                return(new Result());
            }
            return(new Result(Resources.JustGivingUserDataFailed));
        }
コード例 #2
0
        protected override async Task <Result> InitializeInternal()
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.startTime = DateTimeOffset.Now;

            this.user = await this.GetCurrentAccount();

            if (this.user != null)
            {
                if (!string.IsNullOrEmpty(ChannelSession.Settings.JustGivingPageShortName))
                {
                    IEnumerable <JustGivingFundraiser> fundraisers = await this.GetCurrentFundraisers();

                    this.fundraiser = fundraisers.FirstOrDefault(f => f.pageShortName.Equals(ChannelSession.Settings.JustGivingPageShortName));
                }

                AsyncRunner.RunBackgroundTask(this.cancellationTokenSource.Token, 60000, this.BackgroundDonationCheck);
                this.TrackServiceTelemetry("JustGiving");
                return(new Result());
            }
            return(new Result("Unable to get User data"));
        }