/// <summary> /// Called when [selected picture header]. /// </summary> /// <param name="payload">The payload.</param> /// <returns></returns> private async Task OnSelectedPictureHeader(object payload) { try { IsUserInterfaceEnabled = false; var picHeader = payload as PictureHeaderViewModel; MessageHub.Publish(MessageNames.StatusAvailable, $"Loading selected {picHeader.Name}, Taken on {picHeader.DateTakenUtc}"); if (picHeader == null) { return; } // Save the picture before switching it. if (CurrentPicture != null) { await StoreProvider.AddOrUpdatePictureAsync(CurrentPicture); } CurrentPicture = await StoreProvider.LoadPictureAsync(picHeader.PictureId); MessageHub.Publish(MessageNames.StatusAvailable, "Ready"); } catch (Exception ex) { // We send a status message to the hub but it should really be an Error message of its own type MessageHub.Publish(MessageNames.StatusAvailable, $"Error: {ex.Message}"); } finally { IsUserInterfaceEnabled = true; } }