void model_MessageBroadcast(LobbyServer model, int userId, string content) { User u = model.GetUser(userId); UIDispatcher.Invoke(() => { if (u != null) chat.AppendText("\n" + u.Name + ": " + content); else chat.AppendText("\n" + "[" + userId + "]" + ": " + content); }); }
void model_UserChanged(LobbyServer sender, int userId) { //thread UIDispatcher.Invoke(() => { User u = sender.GetUser(userId); UserVM uvm = usersDictionary.ValueOrDefault(userId); if (u == null) { usersDictionary.Remove(userId); users.Remove(uvm); string x = "\n<SYSTEM> User"+ userId; if (uvm != null) x += " " + uvm.Name; chat.AppendText(x + " exits."); } else { if (uvm == null) AddUser(u); else uvm.RefreshProperties(u); } }); }