コード例 #1
0
        private async Task UpdatePhoto()
        {
            try
            {
                _telemetryClient.TrackEvent(TelemetryEvents.UpdatePhotoInitiated);

                // The user needs to be signed-in
                await _authEnforcementHandler.CheckUserAuthentication();

                // If the current category is not selected, prompt
                // the user to select one.
                if (Category == null)
                {
                    Category = await _navigationFacade.ShowCategoryChooserDialog();

                    // If category is still not selected (User can always cancel),
                    // we need to cancel the upload.
                    if (Category == null)
                    {
                        throw new CategoryRequiredException();
                    }
                }

                IsBusy = true;

                Photo.Caption    = Comment;
                Photo.CategoryId = Category.Id;

                await _photoService.UpdatePhoto(Photo);

                _navigationFacade.NavigateToPhotoDetailsView(Category.ToCategoryPreview(), Photo);

                _telemetryClient.TrackEvent(TelemetryEvents.UpdatePhotoSuccess);
            }
            catch (CategoryRequiredException)
            {
                // Swallow exception. User canceled selecting a category.
            }
            catch (SignInRequiredException)
            {
                // Swallow exception. User canceled the Sign-in dialog.
            }
            catch (ServiceException)
            {
                await _dialogService.ShowNotification("GenericError_Message", "GenericError_Title");
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #2
0
 private void OnHeroImageSelected(Photo photo)
 {
     _navigationFacade.NavigateToPhotoDetailsView(photo);
 }
コード例 #3
0
 /// <summary>
 /// Action to take when a photo has been selected
 /// </summary>
 /// <param name="photo">The photo.</param>
 private void OnPhotoSelected(Photo photo)
 {
     SelectedPhoto = photo;
     _navigationFacade.NavigateToPhotoDetailsView(Category, photo);
 }
コード例 #4
0
 private void OnHeroImageSelected(Photo photo)
 {
     _telemetryClient.TrackEvent(TelemetryEvents.HeroImageSelected);
     _navigationFacade.NavigateToPhotoDetailsView(photo);
 }
コード例 #5
0
 /// <summary>
 /// Action to take when a photo has been selected
 /// </summary>
 /// <param name="photo">the photo.</param>
 private void OnPhotoSelected(Photo photo)
 {
     _telemetryClient.TrackEvent(TelemetryEvents.PhotoStreamItemSelected);
     _navigationFacade.NavigateToPhotoDetailsView(photo);
 }