예제 #1
0
파일: BaseViewModel.cs 프로젝트: rayxxi/MVP
        public virtual Task BackAsync()
        {
            if (isNavigating)
            {
                return(Task.CompletedTask);
            }

            isNavigating = true;

            return(NavigationHelper.BackAsync().ContinueWith((x) => isNavigating = false));
        }
예제 #2
0
        async Task DeleteContribution()
        {
            try
            {
                // Shouldn't be getting here anyway, so no need for a message.
                if (!Contribution.StartDate.IsWithinCurrentAwardPeriod())
                {
                    return;
                }

                // Ask for confirmation before deletion.
                var confirm = await DialogService.ConfirmAsync("Are you sure you want to delete this contribution? You cannot undo this.", Alerts.HoldOn, Alerts.OK, Alerts.Cancel);

                if (!confirm)
                {
                    return;
                }

                var isDeleted = await MvpApiService.DeleteContributionAsync(Contribution);

                if (isDeleted)
                {
                    // TODO: Pass back true to indicate it needs to refresh.
                    await NavigationHelper.BackAsync().ConfigureAwait(false);
                }
                else
                {
                    await DialogService.AlertAsync("Your contribution could not be deleted. Perhaps it was already deleted, or it took place in the previous award period?", Alerts.Error, Alerts.OK);
                }
            }
            catch (Exception ex)
            {
                AnalyticsService.Report(ex);
                await DialogService.AlertAsync(Alerts.UnexpectedError, Alerts.Error, Alerts.OK).ConfigureAwait(false);
            }
        }
 async Task Back()
 {
     await NavigationHelper.BackAsync().ConfigureAwait(false);
 }
예제 #4
0
 public async virtual Task Back()
 {
     await NavigationHelper.BackAsync().ConfigureAwait(false);
 }