virtual protected void OnNewList(ImListReceivedFromServerArgs e) { if (ListEventHandler != null) { ListEventHandler(this, e); } }
private void _clientHandler_ListEventHandler(object sender, ImListReceivedFromServerArgs e) { Application.Current.Dispatcher.Invoke(new Action(() => { foreach (IMLibrary.Client client in e.ClientList) { if (GeneratedClientList.Count(cli => cli.UserName == client.UserName) == 0) { ChatDialogueLocal chatDialogoue = new ChatDialogueLocal { lblUsername = { Content = client.UserName }, lblFingerPrint = { Content = client.FingerPrint } }; chatDialogoue.ChangeColourOfPrint(); chatDialogoue.LoadPrint(); User user = new User(client.UserName, client.Available, client.FingerPrint, client.PublicKey, client.Buddies, 0); _clientPromtList.Add(new Tuple <IMLibrary.Client, ChatDialogueLocal>(user, chatDialogoue)); GeneratedClientList.Add(user); } else { GeneratedClientList.First(cli => cli.UserName == client.UserName).Available = client.Available; GeneratedClientList.First(cli => cli.UserName == client.UserName).PublicKey = client.PublicKey; GeneratedClientList.First(cli => cli.UserName == client.UserName).FingerPrint = client.FingerPrint; _clientPromtList.Single(cli => cli.Item1.UserName == client.UserName).Item2.lblFingerPrint.Content = client.FingerPrint; _clientPromtList.Single(cli => cli.Item1.UserName == client.UserName).Item2.ChangeColourOfPrint(); _clientPromtList.Single(cli => cli.Item1.UserName == client.UserName).Item2.LoadPrint(); } } })); }