public void SendMessage(EasyMessage message) { // only programmable blocks can receive messages if (Type() == "Programmable block") { SetName(Name() + "\0" + message.Serialize()); } }
public EasyBlocks SendMessage(EasyMessage message) { for (int i = 0; i < this.Blocks.Count; i++) { this.Blocks[i].SendMessage(message); } return(this); }
// Get messages sent to this block public List <EasyMessage> GetMessages() { var mymessages = new List <EasyMessage>(); var parts = this.Self.Name().Split('\0'); if (parts.Length > 1) { for (int n = 1; n < parts.Length; n++) { EasyMessage m = new EasyMessage(parts[n]); mymessages.Add(m); } // Delete the messages once they are received this.Self.SetName(parts[0]); } return(mymessages); }
// Get messages sent to this block public List<EasyMessage> GetMessages() { var mymessages = new List<EasyMessage>(); var parts = this.Self.Name().Split('\0'); if(parts.Length > 1) { for(int n = 1; n < parts.Length; n++) { EasyMessage m = new EasyMessage(parts[n]); mymessages.Add(m); } // Delete the messages once they are received this.Self.SetName(parts[0]); } return mymessages; }
static void HandleEasynMessage(EasyMessage textMessage) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Got message: {0}", textMessage.Test); Console.ResetColor(); }