private void SendMessageSetting(string message, string mailbox, string format) { FormatType formatType = FormatType.Hex; MonoBrick.NXT.Box mailBoxEnum = MonoBrick.NXT.Box.Box0; foreach (ComboBoxExtensions.Entry e in MailboxOption.EntryList) { if (e.Name == mailbox) { mailBoxEnum = (MonoBrick.NXT.Box)e.Value; } } foreach (ComboBoxExtensions.Entry e in FormatOption.EntryList) { if (e.Name == format) { formatType = (FormatType)e.Value; } } if (formatType == FormatType.Hex) { brick.Mailbox.Send(ConvertHexStringToByteArray(message), mailBoxEnum, false); } else { brick.Mailbox.Send(message, mailBoxEnum, false); } }
public static String MailBoxToString(MonoBrick.NXT.Box box) { if (box == MonoBrick.NXT.Box.Box0) { return("mailbox 0"); } if (box == MonoBrick.NXT.Box.Box1) { return("mailbox 1"); } if (box == MonoBrick.NXT.Box.Box2) { return("mailbox 2"); } if (box == MonoBrick.NXT.Box.Box3) { return("mailbox 3"); } if (box == MonoBrick.NXT.Box.Box4) { return("mailbox 4"); } if (box == MonoBrick.NXT.Box.Box5) { return("mailbox 5"); } if (box == MonoBrick.NXT.Box.Box6) { return("mailbox 6"); } if (box == MonoBrick.NXT.Box.Box7) { return("mailbox 7"); } if (box == MonoBrick.NXT.Box.Box8) { return("mailbox 8"); } if (box == MonoBrick.NXT.Box.Box9) { return("mailbox 9"); } //default return("mailbox 0"); }