[ABANDONED] GUI,WPF. How to correctly display information?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] GUI,WPF. How to correctly display information?

    Hello everyone, i am writing GUI for this microcontroller (nordicsemi.com/products/nrf52811), using J_Link EDU (segger.com/products/debug-probes/j-link/models/j-link-edu/).
    No message is displayed when JLink.exe starts and nothing happens when the "ReadMemory" button is pressed. But when you enter the command "exit" (exit from JLink.exe) all the information appears. How can you fix this and why is it happening?

    C Source Code

    1. public partial class MainWindow : Window
    2. {
    3. Process jLinkProcess = new Process();
    4. public MainWindow()
    5. {
    6. InitializeComponent();
    7. }
    8. private void Window_Loaded(object sender, RoutedEventArgs e)
    9. {
    10. jLinkProcess.StartInfo = new ProcessStartInfo(@"C:\Program Files\SEGGER\JLink\JLink.exe");
    11. jLinkProcess.StartInfo.UseShellExecute = false;
    12. jLinkProcess.StartInfo.RedirectStandardInput = true;
    13. jLinkProcess.StartInfo.RedirectStandardOutput = true;
    14. jLinkProcess.StartInfo.RedirectStandardError = true;
    15. jLinkProcess.StartInfo.CreateNoWindow = true;
    16. jLinkProcess.OutputDataReceived += CmdProcess_OutputDataReceived;
    17. jLinkProcess.ErrorDataReceived += CmdProcess_ErrorDataReceived;
    18. jLinkProcess.Start();
    19. jLinkProcess.BeginOutputReadLine();
    20. jLinkProcess.BeginErrorReadLine();
    21. jLinkProcess.StandardInput.WriteLine("connect");
    22. jLinkProcess.StandardInput.WriteLine("NRF52811_XXAA");
    23. jLinkProcess.StandardInput.WriteLine("SWD");
    24. jLinkProcess.StandardInput.WriteLine("4000");
    25. }
    26. private void CmdProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
    27. {
    28. Dispatcher.Invoke(() =>
    29. {
    30. TextBox2.Text += e.Data + "\r\n";
    31. TextBox2.ScrollToEnd();
    32. });
    33. }
    34. private void CmdProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
    35. {
    36. Dispatcher.Invoke(() =>
    37. {
    38. TextBox2.Text += e.Data + "\r\n";
    39. TextBox2.ScrollToEnd();
    40. });
    41. }
    42. private void TextBox1_PreviewKeyDown(object sender, KeyEventArgs e)
    43. {
    44. if (sender is TextBox textBox && e.Key == Key.Enter)
    45. {
    46. jLinkProcess.StandardInput.WriteLine(textBox.Text);
    47. textBox.Text = string.Empty;
    48. e.Handled = true;
    49. }
    50. }
    51. private void ReadMemory(object sender, RoutedEventArgs e)
    52. {
    53. string mac = "mem 10000060,8";
    54. jLinkProcess.StandardInput.WriteLine(mac);
    55. }
    56. }
    Display All