public async void InviteUser(Profile profile)
        {
            string message = string.Format("Are you sure you want to invite '{0}' to share the list '{1}'? They will have full permissions over the list, including the ability to invite other users",
                profile.Name,
                _parent.CurrentList.Name);

            await _parent.PopupService.ShowDialogAsync("Invite user?", message,
                new SimpleCommand("Yes", async () =>
                {
                    try
                    {
                        await _parent.InviteUser(profile);
                    }
                    catch (MobileServiceInvalidOperationException exc)
                    {
                        // The server validates invitations, handle expected responses
                        // and display a friendly message to the user
                        if (exc.Response.StatusCode == 400)
                        {
                            _parent.ShowError(exc.Response.Content);
                        }
                        else
                        {
                            throw;
                        }
                    }
                    _dismiss();
                }),
                new SimpleCommand("Cancel", () =>
                {
                    // nothing to do
                }));
        
            
        }
Beispiel #2
0
 public async void InviteUserAsync(Profile profile)
 {
     try
     {
         await parent.InviteUserAsync(profile);
     }
     catch (MobileServiceInvalidOperationException exc)
     {
         // The server validates invitations, handles expected responses
         // and displays a friendly message to the user
         if (exc.Response.StatusCode == HttpStatusCode.BadRequest)
         {
             parent.ShowError(exc.Message);
         }
         else
         {
             parent.ShowError("An unexpected error occured. Please try again later.");
         }
     }
 }
        /// <summary>
        /// Invites a user to join the current list
        /// </summary>
        public async Task InviteUser(Profile user)
        {
            await _invitesTable.InsertAsync(new Invite()
            {
                FromUserId = User.UserId,
                FromUserName = User.Name,
                FromImageUrl = User.ImageUrl,
                ToUserId = user.UserId,
                ToUserName = user.Name,
                ListId = CurrentList.ListId,
                ListName = CurrentList.Name
            });

            await _popupService.ShowDialogAsync("Invite Sent", string.Format("Invite sent to {0}", user.Name));
            return;
        }
 /// <summary>
 /// Registers the user's profile with Mobile Services
 /// </summary>
 /// <param name="liveProfile">The response from Live Connect to get '/me'</param>
 /// <param name="livePicture">The response from Live Connect to get '/me/picture'</param>
 /// <param name="userId"></param>
 private void RegisterUser(dynamic liveProfile, dynamic livePicture, string userId)
 {
     User = new Profile
     {
         Name = liveProfile.name ?? "",
         UserId = userId,
         City = liveProfile.addresses.personal.city ?? "",
         State = liveProfile.addresses.personal.state ?? "",
         ImageUrl = livePicture.location
     };
     DisplayRegistrationForm = true;
 }
        /// <summary>
        /// Invites a user to join the current list
        /// </summary>
        public async Task InviteUserAsync(Profile user)
        {
            await invitesTable.InsertAsync(new Invite()
            {
                FromUserId = User.UserId,
                FromUserName = User.Name,
                FromImageUri = User.ImageUri,
                ToUserId = user.UserId,
                ToUserName = user.Name,
                ListId = CurrentList.ListId,
                ListName = CurrentList.Name
            });

            return;
        }
 /// <summary>
 /// Registers the user's profile with Windows Azure Mobile Service
 /// </summary>
 /// <param name="userId"></param>
 private void RegisterUser(string userId)
 {
     User = new Profile
     {
         Name = String.Empty,
         UserId = userId,
         City = String.Empty,
         State = String.Empty,
         ImageUri = String.Empty
     };
     DisplayRegistrationForm = true;
 }