private void Button_Click(object sender, RoutedEventArgs e) { byte[] data = HexCode.GetHex(toSendData.Text); if (data == null) { MessageBox.Show("Data is empty"); return; } _sender.SendMessage(new MessageData(LegalMessageType.MessageTypesDictionaryWithName["c7"], HexCode.GetHex(toSendData.Text)), (str) => { }); }
/// <summary> /// 导出报文类型文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ExportJSON(object sender, RoutedEventArgs e) { if (_controls.TypeFoot != "" && _controls.TypeHead != "" && _controls.TypeName != "") { type = new MessageType { MessageLength = _controls.TypeLength, TypeFoot = Encryption.AESEncrypter.Encrypt(HexCode.GetHex(_controls.TypeFoot), _controls.TypeName), TypeFootLength = HexCode.GetHex(_controls.TypeFoot).Length, TypeHead = Encryption.AESEncrypter.Encrypt(HexCode.GetHex(_controls.TypeHead), _controls.TypeName), TypeHeadLength = HexCode.GetHex(_controls.TypeFoot).Length, TypeName = _controls.TypeName, }; FileHandler.WriteJson(@"./MessageTypes/" + type.TypeName + ".json", type, (message) => { SnackbarThree.MessageQueue.Enqueue(message); }); } }