コード例 #1
0
 async void MvpApiService_RequestErrorOccurred(object sender, Services.Helpers.ApiServiceEventArgs e)
 {
     if (e.IsBadRequest)
     {
         await DialogService.AlertAsync(Translations.error_badrequest, Translations.error_title, Translations.ok);
     }
     else if (e.IsServerError)
     {
         await DialogService.AlertAsync(Translations.error_servererror, Translations.error_title, Translations.ok);
     }
 }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: z33bs/MVP
 async void MvpApiService_RequestErrorOccurred(object sender, Services.Helpers.ApiServiceEventArgs e)
 {
     if (e.IsBadRequest)
     {
         await dialogService.AlertAsync(
             "That request wasn't quite right. Try again later.",
             "Oh boy, that's not good!",
             "OK");
     }
     else if (e.IsServerError)
     {
         await dialogService.AlertAsync(
             "The MVP API messed something up. Couldn't grab that data right now.",
             "Oh boy, that's not good!",
             "OK");
     }
 }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: rayxxi/MVP
        /// <summary>
        /// Handles expired access tokens.
        /// </summary>
        async void MvpApiService_AccessTokenExpired(object sender, Services.Helpers.ApiServiceEventArgs e)
        {
            // If the access token expired, we need to sign in again,
            // because we might've lost our auth.
            var result = await AuthService.SignInAsync();

            if (!result)
            {
                // Show a message that data could not be refreshed. Also forward the user back to getting started
                // telling the user that a logout has occurred.
                await DialogService.AlertAsync(Translations.alert_error_unauthorized, Translations.error_title, Translations.ok);

                // Move the user over to Getting Started.
                await AuthService.SignOutAsync();

                var navHelper = Resolver.Resolve <INavigationHelper>();
                navHelper.SetRootView(nameof(IntroPage));
            }
        }
コード例 #4
0
ファイル: App.xaml.cs プロジェクト: z33bs/MVP
        async void MvpApiService_AccessTokenExpired(object sender, Services.Helpers.ApiServiceEventArgs e)
        {
            // If the access token expired, we need to sign in again,
            // because we might've lost our auth.
            var result = await authService.SignInAsync();

            if (!result)
            {
                // Show a message that data could not be refreshed. Also forward the user back to getting started
                // telling the user that a logout has occurred.
                await dialogService.AlertAsync(
                    "Your credentials have expired. We needed to log you out. Please login again to continue.",
                    "Oh boy, that's not good!",
                    "OK");

                // Move the user over to Getting Started.
                await authService.SignOutAsync();

                var navHelper = Resolver.Resolve <INavigationHelper>();
                navHelper.SetRootView(nameof(IntroPage));
            }
        }