private void SelectPartner(object sender, EventArgs e) { var form = new SelectPartnerForm((ToolStripMenuItem)sender); DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { //2014.04.25. string[] partners = form.Partners; ChatPanel tmpchat = new ChatPanel(); for (int i = 0; i < partners.Length; i++) { if (partners[i] != "") //2014.04.17. { for (int j = 0; j < UserInfo.KnownUsers.Count; j++) { if (!UserInfo.KnownUsers[j].IsPartner) { continue; } int tmp; //2014.04.17. if (!Int32.TryParse(partners[i], out tmp)) { tmp = -1; } if (UserInfo.KnownUsers[j].UserName == partners[i] || UserInfo.KnownUsers[j].Email == partners[i] || UserInfo.KnownUsers[j].UserID == tmp) { //Egyezik a név, E-mail vagy ID - UserName: 2014.04.17. tmpchat.ChatPartners.Add(UserInfo.KnownUsers[j]); //2014.08.28. } } } } if (tmpchat.ChatPartners.Count != 0) { ChatPanel.ChatWindows.Add(tmpchat); if (sender == fájlKüldéseToolStripMenuItem) { //tmpchat.Show(); tmpchat.Init(); tmpchat.OpenSendFile(form); } if (sender == azonnaliÜzenetKüldéseToolStripMenuItem) { //tmpchat.Show(); tmpchat.Init(); } } } }
internal static void ReopenChatWindows(bool settingchanged) { for (int i = 0; i < ChatWindows.Count; i++) { var tmp = ChatWindows[i].ChatPartners; if (settingchanged) { if (Storage.Settings[SettingType.ChatWindow] == "0") //Ha az új beállítás szerint(!) külön ablakokban kell megjeleníteni, akkor hajtsa végre { ((Form)ChatWindows[i].Parent.Parent).Close(); //Ezzel meghívja a saját Close()-ját is } else { ChatWindows[i].Close(); } } else { if (Storage.Settings[SettingType.ChatWindow] == "1") //Ha a régi beállítás szerint(!) külön ablakokban kell megjeleníteni, akkor hajtsa végre { ((Form)ChatWindows[i].Parent.Parent).Close(); //Ezzel meghívja a saját Close()-ját is } else { ChatWindows[i].Close(); } } var tmp2 = new ChatPanel(); tmp2.ChatPartners = tmp; tmp2.Init(); ChatWindows.Add(tmp2); } }
public static ChatPanel Create(IEnumerable <UserInfo> users) { //2015.05.15. ChatPanel cf = null; Program.MainF.Invoke(new Action(() => //Invoke: 2015.05.16. { ChatPanel.ChatWindows.Add(cf = new ChatPanel()); cf.ChatPartners.AddRange(users); if (cf.ChatPartners.Count > 1) //2015.05.23. - Így saját magunkkal is beszélhetünk... { cf.ChatPartners.RemoveAll(entry => entry.UserID == CurrentUser.UserID); //2015.05.16. } cf.Init(); })); return(cf); }