예제 #1
0
        protected override async Task <Result> InitializeInternal()
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.user = await this.GetUser();

            if (this.user != null)
            {
                AsyncRunner.RunBackgroundTask(this.cancellationTokenSource.Token, 60000, this.BackgroundDonationCheck);
                this.TrackServiceTelemetry("Tiltify");
                return(new Result());
            }
            return(new Result("Failed to get User data"));
        }
예제 #2
0
        public async Task <IEnumerable <TiltifyTeam> > GetUserTeams(TiltifyUser user)
        {
            List <TiltifyTeam> results = new List <TiltifyTeam>();

            try
            {
                TiltifyResultArray result = await this.GetAsync <TiltifyResultArray>("users/" + user.ID.ToString() + "/teams");

                foreach (JToken token in result.Data)
                {
                    results.Add(token.ToObject <TiltifyTeam>());
                }
            }
            catch (Exception ex) { Logger.Log(ex); }
            return(results);
        }
예제 #3
0
        protected override async Task <Result> InitializeInternal()
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.user = await this.GetUser();

            if (this.user != null)
            {
#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("Tiltify");
                return(new Result());
            }
            return(new Result(Resources.TiltifyUserDataFailed));
        }