Example #1
0
File: Users.cs Project: weeble/ohos
 public void SetUser(User aUser)
 {
     if (aUser == null)
     {
         throw new ArgumentNullException("aUser");
     }
     lock (iLock)
     {
         User oldValue;
         if (iHandler != null)
         {
             iUsers.TryGetValue(aUser.Id, out oldValue);
             var eventArgs = new UserEventArgs(
                 new[]{ new UserChange(aUser.Id, oldValue, aUser) },
                 false);
             iEventTask.ContinueWith((aTask)=>iHandler(this, eventArgs));
         }
         iUsers[aUser.Id] = aUser;
     }
 }
Example #2
0
File: Users.cs Project: weeble/ohos
 public void RemoveUser(string aUserId)
 {
     if (aUserId == null)
     {
         throw new ArgumentNullException("aUserId");
     }
     lock (iLock)
     {
         User oldValue;
         if (iHandler != null && iUsers.TryGetValue(aUserId, out oldValue))
         {
             var eventArgs = new UserEventArgs(
                 new[]{ new UserChange(aUserId, oldValue, null) },
                 false);
             iEventTask.ContinueWith((aTask)=>iHandler(this, eventArgs));
         }
         iUsers.Remove(aUserId);
     }
 }