예제 #1
0
        private async void OnDeletePhoto()
        {
            if (AppEnvironment.Instance.CurrentUser.ProfilePictureId == Photo.Id)
            {
                await _dialogService.ShowNotification("DeleteProfilePicture_Message", "DeleteProfilePicture_Title");

                return;
            }

            try
            {
                IsBusy = true;
                await _photoService.DeletePhoto(Photo);

                _navigationFacade.NavigateToProfileView();
            }
            catch (ServiceException)
            {
                await _dialogService.ShowGenericServiceErrorNotification();
            }
            finally
            {
                IsBusy = false;
            }
        }
        private async void OnChooseAuthProvider(MobileServiceAuthenticationProvider authenticationProviderProvider)
        {
            try
            {
                await _photoService.SignInAsync(authenticationProviderProvider);

                if (RedirectToProfilePage)
                {
                    _navigationFacade.NavigateToProfileView();
                    _navigationFacade.RemoveBackStackFrames(1);
                }
            }
            catch (AuthenticationException)
            {
                await _dialogService.ShowNotification("AuthenticationFailed_Message", "AuthenticationFailed_Title");
            }
            catch (AuthenticationCanceledException)
            {
                // User canceled, do nothing in this case.
            }
            catch (Exception)
            {
                await _dialogService.ShowNotification("GenericError_Title", "GenericError_Message");
            }
        }
        private async void OnChooseAuthProvider(MobileServiceAuthenticationProvider authenticationProviderProvider)
        {
            try
            {
                _telemetryClient.TrackEvent(TelemetryEvents.SignInInitiated, new Dictionary <string, string>
                {
                    { TelemetryProperties.AuthenticationProvider, authenticationProviderProvider.ToString() }
                });

                await _photoService.SignInAsync(authenticationProviderProvider);

                _telemetryClient.TrackEvent(TelemetryEvents.SignInSuccess, new Dictionary <string, string>
                {
                    { TelemetryProperties.AuthenticationProvider, authenticationProviderProvider.ToString() }
                });

                if (RedirectToProfilePage)
                {
                    _navigationFacade.NavigateToProfileView();
                    _navigationFacade.RemoveBackStackFrames(1);
                }
            }
            catch (AuthenticationException)
            {
                _telemetryClient.TrackEvent(TelemetryEvents.SignInFail);
                await _dialogService.ShowNotification("AuthenticationFailed_Message", "AuthenticationFailed_Title");
            }
            catch (AuthenticationCanceledException)
            {
                _telemetryClient.TrackEvent(TelemetryEvents.SignInCanceled);

                // User canceled, do nothing in this case.
            }
            catch (Exception)
            {
                _telemetryClient.TrackEvent(TelemetryEvents.SignInFail);
                await _dialogService.ShowNotification("GenericError_Title", "GenericError_Message");
            }
        }
예제 #4
0
 private void OnUserSelected(User user)
 {
     _navigationFacade.NavigateToProfileView(user);
 }