Represents user data.
Inheritance: PhotoSharingApp.Universal.ComponentModel.ObservableObjectBase
 private void AppEnvironment_CurrentUserChanged(object sender, User e)
 {
     if (_signInTaskCompletionSource != null)
     {
         _signInTaskCompletionSource.SetResult(SignInCompletionSource.UserChanged);
     }
 }
 private void OnUserSelected(User user)
 {
     _navigationFacade.NavigateToProfileView(user);
 }
Example #3
0
        /// <summary>
        /// Gets photos uploaded by the specified user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="continuationToken">Optional. The continuation token. By default, null.</param>
        /// <returns>The photos.</returns>
        public async Task<PagedResponse<Photo>> GetPhotosForUser(User user, string continuationToken = null)
        {
            try
            {
                if (continuationToken == null)
                {
                    continuationToken = string.Empty;
                }

                var result = await _mobileServiceClient.InvokeApiAsync<PagedResponse<PhotoContract>>($"userphoto/{user.UserId}",
                    HttpMethod.Get,
                    new Dictionary<string, string>
                    {
                        { "continuationToken", continuationToken }
                    });

                return new PagedResponse<Photo> {
                    ContinuationToken = result.ContinuationToken,
                    Items = result.Items.Select(i => i.ToDataModel()).ToList()
                };
            }
            catch (Exception e)
            {
                throw new ServiceException("GetPhotosForUser error", e);
            }
        }
 void CurrentUserChanged(object sender, User e)
 {
     // Notify UI that user has changed.
     NotifyPropertyChanged(nameof(Image));
     NotifyPropertyChanged(nameof(Symbol));
     NotifyPropertyChanged(nameof(Label));
     NotifyPropertyChanged(nameof(SymbolAsChar));
 }
 private void InitUser()
 {
     User = new User
     {
         ProfilePictureUrl = "https://canaryappstorage.blob.core.windows.net/dummy-container/a11_tn.jpg",
         GoldBalance = 50,
         UserId = "a71a39ee-8d81-4d1a-8209-903a2444acf5"
     };
 }
 /// <summary>
 /// Gets photos uploaded by the specified user.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="continuationToken">Optional. The continuation token. By default, null.</param>
 /// <returns>The photos.</returns>
 public Task<PagedResponse<Photo>> GetPhotosForUser(User user, string continuationToken = null)
 {
     return GetPhotosForCurrentUser(continuationToken);
 }
 /// <summary>
 /// Navigates to the given user's profile view.
 /// </summary>
 /// <param name="user">The user to show the profile view for.</param>
 public void NavigateToProfileView(User user)
 {
     Navigate(typeof(ProfileViewModel), new ProfileViewModelArgs(user));
 }
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="user">The user to display.</param>
 public ProfileViewModelArgs(User user)
 {
     User = user;
     HighlightOnNavigationBar = false;
 }