C++ C# leads to renewed .NET Multi-platform investigation | Morning Stand Up Apr 4

Since I’m charging up my MacBook anyway this morning, why not take what I’ve learned through c++ and c# and check out Microsoft’s .NET MAUI again to see how it looks? Breaking Replicator into several modules will make multi-platform easier. I like accessing the Windows API via c++. I like programming for Windows Desktop using C#. NetMAUI can help get to Mac, Linux, Android and iPhone, iPad… by setting up a framework.

I recorded the video directly into YouTube’s Shorts feature on Karen’s channel. This saved time.

Links:


Afternoon Update, 3 pm:

  • MAUI was fun, again, but not right for Replicator 3 at this time.
  • Trying the console app child launched by slick parent thing now

Helpful code from https://stackoverflow.com/questions/186822/capturing-console-output-from-a-net-application-c

using System.Diagnostics;

Process process = new Process();

void LaunchProcess()
{
    process.EnableRaisingEvents = true;
    process.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(process_OutputDataReceived);
    process.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(process_ErrorDataReceived);
    process.Exited += new System.EventHandler(process_Exited);

    process.StartInfo.FileName = "some.exe";
    process.StartInfo.Arguments = "param1 param2";
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardError = true;
    process.StartInfo.RedirectStandardOutput = true;

    process.Start();
    process.BeginErrorReadLine();
    process.BeginOutputReadLine();          

    //below line is optional if we want a blocking call
    //process.WaitForExit();
}

void process_Exited(object sender, EventArgs e)
{
    Console.WriteLine(string.Format("process exited with code {0}\n", process.ExitCode.ToString()));
}

void process_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
    Console.WriteLine(e.Data + "\n");
}

void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
    Console.WriteLine(e.Data + "\n");
}

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top