private void FrmChat_Load(object sender, EventArgs e) { FrmLogin frmLogin = new FrmLogin(); frmLogin.ShowDialog(); if (frmLogin.DialogResult == DialogResult.Cancel) { Close(); } // Set window name Text = @"Chat: " + Client.Name; ClientStatistics.Start(); }
// Clients list private void ClientsList(string clientsList) { Invoke(new Action((delegate { //_ClientsColor.Add(new ClientChatProp(ClientConnection.ClientName)); //Add this Client to the ClientChatProp list ListBoxClientList.Items.AddRange(clientsList.Split(',')); //remove the empty selection box in list view ListBoxClientList.Items.RemoveAt(ListBoxClientList.Items.Count - 1); // Add all the connected clients to ClientChatProp list foreach (object t in ListBoxClientList.Items) { _ClientChatHistoryList.Add(new ClientChatHistory(t.ToString())); } RichTextClientPub.SelectionStart = _CursorPosition; RichTextClientPub.SelectionColor = Color.Black; RichTextClientPub.SelectionBackColor = Color.GreenYellow; RichTextClientPub.SelectedText = @"<<< You have joined the chat successfully >>>" + Environment.NewLine; _CursorPosition = RichTextClientPub.SelectionStart; _FrmStatistics.Start(); ClientStatistics.Start(); }))); }