public IAppTab CreateTab(IBrowserTabProxy aTabProxy, User aUser) { var tabKey = Tuple.Create(aTabProxy.SessionId, aTabProxy.TabId); var tab = new ServerHealthAppTab(this, aTabProxy); lock (iLock) { iServerHealthTabs[tabKey] = tab; iIterating = true; foreach (var kvp in iTabStats) { string sessionId = kvp.Key.Item1; string tabId = kvp.Key.Item2; tab.NewMessage( new JsonObject { {"type", "newtab"}, {"session", sessionId}, {"tab", tabId}, {"app", kvp.Value.AppName}, {"queue", kvp.Value.Queue}, {"reader", kvp.Value.Reader}, {"user", kvp.Value.UserId}, {"lastread", kvp.Value.LastRead.ToString()} }); } iIterating = false; } return tab; }
public IAppTab CreateTab(IBrowserTabProxy aTabProxy, User aUser) { int id = counter++; var tab = new TestAppTab(this, aTabProxy, id); lock (iLock) { iTabs.Add(tab); } return tab; }
public IAppTab CreateTab(IBrowserTabProxy aTabProxy, User aUser) { int id = iCounter++; var tab = new LoginAppTab(this, aTabProxy, id); lock (iLock) { iTabs.Add(tab); foreach (var user in iUsers.Values) { tab.NewMessage( new JsonObject { { "type", "user"}, { "userid", user.User.Id }, { "oldValue", JsonNull.Instance }, { "newValue", UserToJson(user.User) } }); } } return tab; }
internal static JsonValue UserToJson(User aUser) { if (aUser == null) return JsonNull.Instance; return new JsonObject { {"id", aUser.Id}, {"displayName", aUser.DisplayName}, {"iconUrl", aUser.IconUrl}}; }
public void ChangeUser(User aUser) { lock (iLock) { string id = aUser == null ? null : aUser.Id; if (iUserId == id) { return; } iUserId = id; } iBrowserTabProxy.SetCookie("xappuser", aUser == null ? null : aUser.Id, new CookieAttributes{Path="/", Expires=DateTime.UtcNow+TimeSpan.FromDays(30)}); iBrowserTabProxy.ReloadPage(); }
public void ChangeUser(User aUser) { lock (iLock) { string id = aUser == null ? null : aUser.Id; if (iUserId == id) { return; } iUserId = id; } if (aUser == null) { iBrowserTabProxy.SetCookie("xappuser", "", new CookieAttributes { Path = "/", Expires = DateTime.UtcNow - TimeSpan.FromDays(1) }); iBrowserTabProxy.ReloadPage(); } iChatApp.RecountUsers(); iBrowserTabProxy.Send( new JsonObject{ {"type","login"}, {"user", ChatApp.UserToJson(aUser, "online")}}); }
public IAppTab CreateTab(IBrowserTabProxy aTabProxy, User aUser) { int id = counter++; var tab = new ChatAppTab(this, aTabProxy, id, iUserList, aUser == null ? null : aUser.Id); lock (iLock) { iTabs.Add(tab); foreach (var user in iUsers.Values) { tab.NewMessage( new JsonObject { { "type", "user"}, { "userid", user.User.Id }, { "oldValue", JsonNull.Instance }, { "newValue", UserToJson(user.User, user.TabCount > 0 ? "online" : "offline") } }); } } tab.NewMessage( new JsonObject{ {"type","login"}, {"user", UserToJson(aUser, "online")}}); RecountUsers(); return tab; }
public void ChangeUser(User aUser) { }
public IAppTab CreateTab(IBrowserTabProxy aTabProxy, User aUser) { return new RootAppTab(this, aTabProxy); }
public IAppTab CreateTab(IBrowserTabProxy aTabProxy, User aUser) { return iBaseApp.CreateTab(aTabProxy, aUser); }
public bool TryGetUserById(string aUserId, out User aUser) { lock (iLock) { return iUsers.TryGetValue(aUserId, out aUser); } }
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; } }
public UserChange(string aUserId, User aOldValue, User aNewValue) { UserId = aUserId; OldValue = aOldValue; NewValue = aNewValue; }
public void ChangeUser(User aUser) { iAppThread.ScheduleExclusive(() => iAppTab.ChangeUser(aUser)); }