コード例 #1
0
        public async Task <Activity> PostActivity(TimesheetAddActivity timesheetAddActivity, DateTime from)
        {
            try
            {
                var url = $"{AppSettings.TimesheetUrlEndPoint}/{from.ToString("yyyy")}/{from.ToString("MM")}/{from.ToString("dd")}";

                var timesheet = await Policy.Handle <Exception>()
                                .WaitAndRetryAsync(1, retryAtemp => TimeSpan.FromMilliseconds(100), async(exception, timeSpan, retryCount, context) => { await _authenticationService.UserIsAuthenticatedAndValidAsync(true); })
                                .ExecuteAsync <Activity>(async() => {
                    return(await _requestService.PostAsync <TimesheetAddActivity, Activity>(url, timesheetAddActivity, AppSettings.AuthenticatedUserResponse.AccessToken));
                });


                timesheet.ProjectId = timesheetAddActivity.ProjectId;
                timesheet.TaskId    = timesheetAddActivity.TaskId;
                return(timesheet);
            }

            catch (Exception e)
            {
                MessagingCenter.Send <ISubscribeMessagingCenter>(this, nameof(UnauthorizedAccessException));
                Crashes.TrackError(e);
                throw e;
            }
        }
コード例 #2
0
 public Task <Activity> PostActivity(TimesheetAddActivity timesheetAddActivity, DateTime dateTime)
 {
     throw new NotImplementedException();
 }