Ejemplo n.º 1
0
 /// <summary>
 /// 实例化一个新的池
 /// </summary>
 public MyPond()
 {
     Tokens = new List<UserTokenAndCallback>();
     using (MainDatadbmlDataContext db = new MainDatadbmlDataContext())
     {
         db.UserInfo.ToList().ForEach(x =>
             {
                 UserToken token = new UserToken(x.UserID, x.ID, x.ParentUID);
                 token.TimeoutEventHandler += RemoveCallback;
                 UserTokenAndCallback t = new UserTokenAndCallback
                 {
                     Token = token,
                     TargetUser = "",
                     Callback = null
                 };
                 Tokens.Add(t);
             });
     }
     StartTimeline();
 }
Ejemplo n.º 2
0
 void CallStatusChanged(UserTokenAndCallback input, string targetUser, UserOnlineStatus newOnlineStatus)
 {
     try
     {
         var t = GetUser(targetUser);
         input.Callback.ChangeOnlineStatus(targetUser, newOnlineStatus, t.Token.IsOfficial);
     }
     catch (Exception)
     {
         RemoveToken(input.Token.Username);
     }
 }