public string getClientJsonString() { ClientInfo clientInfo = new ClientInfo { Computer = Int32.Parse(lblNumberClient.Text), Math = Int32.Parse(lblNumberMatch.Text), MinusBlueSec1 = Int32.Parse(lblMinusSec1Blue.Text), MinusBlueSec2 = Int32.Parse(lblMinusSec2Blue.Text), MinusRedSec1 = Int32.Parse(lblMinusSec1Red.Text), MinusRedSec2 = Int32.Parse(lblMinusSec2Red.Text), ScoreBlueSec1 = Int32.Parse(lblSec1Blue.Text), ScoreBlueSec2 = Int32.Parse(lblSec2Blue.Text), ScoreRedSec1 = Int32.Parse(lblSec1Red.Text), ScoreRedSec2 = Int32.Parse(lblSec2Red.Text), ScoreRed = Int32.Parse(lblSec1Red.Text) + Int32.Parse(lblSec2Red.Text) - Int32.Parse(lblMinusSec1Red.Text) - Int32.Parse(lblMinusSec2Red.Text), ScoreBlue = Int32.Parse(lblSec1Blue.Text) + Int32.Parse(lblSec2Blue.Text) - Int32.Parse(lblMinusSec1Blue.Text) - Int32.Parse(lblMinusSec2Blue.Text), Sex = lblSex.Text, Weight = lblWeight.Text, Win = Variable.WIN, WinForm = getWinform(), Referee = lblRefereeName.Text, EndMath = Variable.ENDMATH }; return clientInfo.getClientJson(clientInfo); }
public void HandleReceivedMessages(ChatHelpingLibrary.Message message) { if (message is ChatMessage) { ChatMessage chatMessage = (ChatMessage)message; if (chatMessage.ReceiverId == 0) { if (selectedDialogId != 0) { Action action = delegate { NewMessagelabel.Text = "Вам пришло новое сообщение в Общий чат"; NewMessageChatId = 0; }; if (InvokeRequired) { Invoke(action); } else { action(); } } ClientInfo findClientInfoList = clientsInfoList.Find(f => f.Id == chatMessage.ReceiverId); int index = clientsInfoList.IndexOf(findClientInfoList); clientsInfoList[index].MessageHistory.Add(chatMessage); if (chatMessage.ReceiverId == selectedDialogId) { RedrawOther(chatMessage.SenderName, chatMessage.Content, chatMessage.DateTime); if (chatMessage.IsAnyFiles) { foreach (FileInMessage fileInMessage in chatMessage.FilesInMessageList) { RedrawFileInDialogPanel(chatMessage.SenderName + "отправил файл", fileInMessage.fileName, chatMessage.DateTime, fileInMessage.fileID); } } } } else { if (chatMessage.SenderId != selectedDialogId) { Action action = delegate { NewMessagelabel.Text = "Вам пришло новое сообщение от " + chatMessage.SenderName; NewMessageChatId = chatMessage.SenderId; }; if (InvokeRequired) { Invoke(action); } else { action(); } } ClientInfo findClientInfoList = clientsInfoList.Find(f => f.Id == chatMessage.SenderId); int index = clientsInfoList.IndexOf(findClientInfoList); clientsInfoList[index].MessageHistory.Add(chatMessage); if (chatMessage.SenderId == selectedDialogId) { RedrawOther(chatMessage.SenderName, chatMessage.Content, chatMessage.DateTime); if (chatMessage.IsAnyFiles) { foreach (FileInMessage fileInMessage in chatMessage.FilesInMessageList) { RedrawFileInDialogPanel(chatMessage.SenderName + "отправил файл", fileInMessage.fileName, chatMessage.DateTime, fileInMessage.fileID); } } } } } if (message is ClientsListMessage) { ClientsListMessage clientsListMessage = (ClientsListMessage)message; clientsInfoList = clientsListMessage.clientInfoList; currentClient.MyId = clientsListMessage.YourId; RefreshOnlineListBox(); } if (message is ActionWithClientMessage) { ActionWithClientMessage actionWithClientMessage = (ActionWithClientMessage)message; if (actionWithClientMessage.ActionType == 1) { ClientInfo clientInfo = new ClientInfo(); clientInfo.Id = actionWithClientMessage.ClientId; clientInfo.Name = actionWithClientMessage.ClientName; clientsInfoList.Add(clientInfo); } else if (actionWithClientMessage.ActionType == 0) { var removeValue = clientsInfoList.First(x => x.Id == actionWithClientMessage.ClientId); clientsInfoList.Remove(removeValue); } RefreshOnlineListBox(); } }
private void ChangeDialog() { selectedClientDialog = (ClientInfo)OnlineListBox.SelectedItem; ChatNameLabel.Text = selectedClientDialog.Name; RefreshChatPanel(selectedClientDialog.MessageHistory); }
public ClientComm(string IRType) { _IPEndPoint = new IPEndPoint(_IPAddress, _IPPort); _clientInfo = new ClientInfo(IRType); }
public override string ToString() { return("Client Info: {\n" + ClientInfo.ToString() + "Time:\t" + DateTime.ToString()); }
/*public CollectedData(ClientInfo clientInfo) * { * this.clientInfo = clientInfo; * dateTime = DateTime.Now; * }*/ public void InitialiseAll(ClientInfo clientInfo) { ClientInfo = clientInfo; DateTime = DateTime.Now; }
public string getClientJson(ClientInfo clientInfo) { string clientJson = JsonConvert.SerializeObject(clientInfo); clientJson = "{\"ClientInfo\":" + clientJson + "}"; return clientJson; }