private void AddContact(Packet p) { Packet temp = new Packet(Status.addContact); temp.DestinationUsername = p.DestinationUsername; if (_database.AddContact(p.Username, p.DestinationUsername)) { _database.AddContact(p.DestinationUsername, p.Username); temp.GetStatus = Status.contactAdded; Dictionary <string, bool> contacts = _database.GetContacts(p.Username); Dictionary <string, bool> contacts2 = _database.GetContacts(p.DestinationUsername); _u("[SUCCESS] Add Contact : " + p.DestinationUsername + " to USER: "******"[FAILED] Cannot Add Contact : " + p.DestinationUsername + " to USER: "******" That user does not exsist..."); } Sessions.SendTo(JsonConvert.SerializeObject(temp), p.GetID); }
private void uxListBoxUserNames_SelectedIndexChanged(object sender, EventArgs e) { int selected = uxListBoxUserNames.SelectedIndex; string item = (string)uxListBoxUserNames.Items[selected]; string[] items = item.Split(' '); Dictionary <string, bool> d = sd.GetContacts(items[0]); uxListBoxContacts.Items.Clear(); uxListBoxContacts.EndUpdate(); foreach (string name in d.Keys) { uxListBoxContacts.Items.Add(name); } uxListBoxContacts.EndUpdate(); }