private void Receiver() { IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, port); AddMessage messageDelegate = MessageReceived; while (true) { byte[] data = receivingClient.Receive(ref endPoint); string message = Encoding.ASCII.GetString(data); messageDelegate?.Invoke(message); } }
public void ReceiveMessage() { _listMessage = Util.DeserializeTypeObject <List <Message> >(Util.ReadAllBytes(_tcpClient)).Obj; foreach (var message in _listMessage) { AddMessage?.Invoke(null, message); } while (true) { var message = Util.DeserializeTypeObject <Message>(Util.ReadAllBytes(_tcpClient)); if (message.TypeSoketMessage == Util.TypeSoketMessage.Message) { AddMessage?.Invoke(null, message.Obj); } } }
public void AddError(string message) { AddMessage?.Invoke(this, new MessageHandlerArgs(MessageHandlerArgs.MessageType.Error, message)); }
public void AddWarning(string message) { AddMessage?.Invoke(this, new MessageHandlerArgs(MessageHandlerArgs.MessageType.Warning, message)); }
public void AddInfo(string message) { AddMessage?.Invoke(this, new MessageHandlerArgs(MessageHandlerArgs.MessageType.Info, message)); }
public IEnumerator WaitForNextMessage(float time, int teacherNum) { yield return(new WaitForSeconds(time)); AddMessage?.Invoke(teacherNum); }