示例#1
0
 public void LogInAutomatically(Common_Library.AccountBase a)
 {
     Wait();
     Models.Account account = DataService.Account.GetAccount(new Models.Account()
     {
         UserName = a.UserName, Password = a.Password
     });
     if (account != null)
     {
         OnlineUser onlineUser = OnlineUsers.FirstOrDefault(o => o.HasAccount(account.UserName));
         if (onlineUser != null)
         {
             onlineUser.AddConnectionId(Context.ConnectionId);
         }
         else
         {
             onlineUser = OnlineUser.CreateNewOnlineUser(account, Context.ConnectionId);
             OnlineUsers.Add(onlineUser);
         }
         Clients.Client(Context.ConnectionId).LogInComplete();
     }
     else
     {
         Clients.Client(Context.ConnectionId).AccountNotExist();
     }
     Signal();
 }