c# - 缓冲区 Jlink.exe
问题描述
这样的问题 应用程序(Jlink.exe)写入缓冲区,直到缓冲区满,没有数据显示。如果退出应用程序,缓冲区将刷新到控制台。我怎样才能解决这个问题?如何在不离开应用程序的情况下显示数据 (Jlink.exe)。
public partial class MainWindow : Window
{
Process jLinkProcess = new Process();
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
jLinkProcess.StartInfo = new ProcessStartInfo(@"C:\Program Files\SEGGER\JLink\JLink.exe");
jLinkProcess.StartInfo.UseShellExecute = false;
jLinkProcess.StartInfo.RedirectStandardInput = true;
jLinkProcess.StartInfo.RedirectStandardOutput = true;
jLinkProcess.StartInfo.RedirectStandardError = true;
jLinkProcess.StartInfo.CreateNoWindow = true;
jLinkProcess.OutputDataReceived += jLinkProcess_OutputDataReceived;
jLinkProcess.ErrorDataReceived += jLinkProcess_ErrorDataReceived;
jLinkProcess.Start();
jLinkProcess.BeginOutputReadLine();
jLinkProcess.BeginErrorReadLine();
jLinkProcess.StandardInput.WriteLine("connect");
jLinkProcess.StandardInput.WriteLine("NRF52811_XXAA");
jLinkProcess.StandardInput.WriteLine("SWD");
jLinkProcess.StandardInput.WriteLine("4000");
}
private void jLinkProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
Dispatcher.Invoke(() =>
{
TextBox2.Text += e.Data + "\r\n";
TextBox2.ScrollToEnd();
});
}
private void jLinkProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
Dispatcher.Invoke(() =>
{
TextBox2.Text += e.Data + "\r\n";
TextBox2.ScrollToEnd();
});
}
private void TextBox1_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (sender is TextBox textBox && e.Key == Key.Enter)
{
jLinkProcess.StandardInput.WriteLine(textBox.Text);
textBox.Text = string.Empty;
e.Handled = true;
}
}
private void ReadMemory(object sender, RoutedEventArgs e)
{
string mac = "mem 10000060,8";
jLinkProcess.StandardInput.WriteLine(mac);
}
}
解决方案
推荐阅读
- html - 如何通过ajax拆分json数据并将相关数据设置为相关的html文本
- node.js - 雪花连接clientSessionKeepAlive
- python - Python电子邮件不发送电子邮件
- visual-studio-code - 从 Ubuntu WSL2 运行 VSCode 不起作用
- javascript - 尝试用 TypeScript 中的字符串中的其他字符替换某些字符
- postgresql - 需要有关如何 pytest(模拟)从 db 返回查询结果的方法的输入
- reactjs - 使用“useEffect”对象可能为空
- javascript - 当我隐藏元素时,页面的滚动顶部发生了变化
- mongodb - 条件 addFields 到 MongoDb 中的嵌入对象
- mongodb - MongoDB 部分索引不适用于 $elemMatch