private void PrepareSendPackage() { BinFileHelper.PrepareFile(TxtSelectedFile.Text); BinFileHelper.SetReadLength(int.Parse(TxtReadLength.Text)); BinFileHelper.SetFixBytes(GetPrefixBytes(), GetTailfixBytes()); BinFileHelper.PrepareNextBytes(); DisplayPreparedPackageString(); }
private void SendPreparedBytes() { if (!BinFileHelper.SendBytesPrepared) { LblMessages.Content = $"小姐姐们还没准备好!事情是这样的:{BinFileHelper.GetOperateMessage()}。时间:{DateTime.Now:HH:mm:ss fff}"; return; } if (!SerialPortHelper.SendBytes(BinFileHelper.GetPreparedBytes())) { LblMessages.Content = $"发送失败了,你猜是为什么?消息是这样的:{SerialPortHelper.LastException()}。时间:{DateTime.Now:HH:mm:ss fff}"; return; } TxtSendBytes.AppendText(BinFileHelper.GetPreparedString() + "\r\n\r\n"); TxtSendBytes.ScrollToEnd(); LblSendedBytesCount.Content = BinFileHelper.CountAlreadySend().ToString(); LblWaitForSend.Content = BinFileHelper.CountExisted().ToString(); BinFileHelper.PrepareNextBytes(); DisplayPreparedPackageString(); }