public void ShowReceivedMessage(Message message) { if (message is AllMessage) { if (message is PrivateMessage) { PrivateMessage mes = (PrivateMessage)message; if (client.ClientID == mes.reciverID) { RefreshListBox(1); } } else { RefreshListBox(0); } } if (message is HistoryMessageAnswer) { RefreshListBox(0); } if (message is MembersListMessage) { chatMembers = client.Members; RefreshMemners(); } }
private void AnswerRequestManager(Message message) { Action action = delegate { ServerAnswerRequest mes = (ServerAnswerRequest)message; if (mes.Existance == true) { ClientID.Visible = true; label3.Visible = true; SerwerConnect.Visible = true; } else { client.TCPConnectServer(ClientName.Text, 0); DownloadFile.Enabled = true; AddFile.Enabled = true; DeleteFile.Enabled = true; } }; if (InvokeRequired) { Invoke(action); } else { action(); } }
public void ShowReceivedMessage(Message message) { if (message is ServerAnswerRequest) { AnswerRequestManager(message); } if (message is ClientIDMessage) { IDManager(message); } if (message is FileListMessage) { RefreshFiles(); } }
private void IDManager(Message message) { Action action = delegate { ClientIDMessage mes = (ClientIDMessage)message; ClientID.Visible = true; label3.Visible = true; ClientID.Enabled = false; ClientID.Text = mes.Id.ToString(); }; if (InvokeRequired) { Invoke(action); } else { action(); } }