Esempio n. 1
0
        public Task CreateUserAsync(User user)
        {
            if (!users.ContainsKey(user.UserId))
            {
                users[user.UserId] = user;
                user.Id = users.Count - 1;
            }
            else
            {
                user.Id = users[user.UserId].Id;
                users[user.UserId].Name = user.Name;
                users[user.UserId].MpnsChannel = user.MpnsChannel;

            }

            foreach (string email in user.EmailAddresses.Split(' '))
            {
                emailAddressToUserId[email] = user.UserId;
            }

            return Task.FromResult(0);
        }
Esempio n. 2
0
 public async Task CreateUserAsync(User user)
 {
     await usersTable.InsertAsync(user);
 }
Esempio n. 3
0
        private async System.Threading.Tasks.Task Authenticate()
        {
            var liveIdClient = new LiveAuthClient(MobileServiceConfig.LiveClientId);

            while (session == null)
            {

                LiveLoginResult result = await liveIdClient.LoginAsync(new[] { "wl.basic" });
                if (result.Status == LiveConnectSessionStatus.Connected)
                {
                    session = result.Session;
                    MobileServiceUser user = await authenticationService.LoginAsync(result.Session.AuthenticationToken);
                    
                    var client = new LiveConnectClient(session);
                    LiveOperationResult meResult = await client.GetAsync("me");

                    CurrentUser = new User();
                    CurrentUser.UserId = user.UserId;                    
                    CurrentUser.Name = meResult.Result["first_name"].ToString();            
                }
                else
                {
                    session = null;
                    // TODO Login required
                }
            }

        }