public static void CheckAndUpdate(ListBox list, FORMS.COMPONENTS.MAINPANEL.Chat form) { if (form.ChatList.Count < DbConnect.GetMessages(form.SelectedChat.ChatId).Count) { int oldCount = form.ChatList.Count; form.ChatList = DbConnect.GetMessages(form.SelectedChat.ChatId); for (int i = oldCount; i < form.ChatList.Count; i++) { list.Items.Add(form.ChatList[i]); } } }
public static void ChangeChat(CHAT.Data selectedItem, int selectedIndex) { if (selectedIndex != -1) { // checks if the panels are filled, if so they are emtied if (!MainPanelAvailable()) { _mainPanel.Controls.Clear(); } // Start up new form: Form mainForm = new FORMS.COMPONENTS.MAINPANEL.Chat(selectedItem, _client); // Set the properties of form that is inserted into the main panel mainForm.TopLevel = false; mainForm.AutoScroll = false; _mainPanel.Controls.Add(mainForm); mainForm.Show(); } }