private void OutputBoxPrintLn(string message)
{
if (noWindow)
{
DebugOutput.PrintLn(message);
return;
}
if (!OutputBox.Parent.Created)
{
Task.Run(() =>
{
try
{
while (!OutputBox.Parent.Created)
System.Threading.Thread.Sleep(100);
OutputBoxPrintLn(message);
}
catch
{
return;
}
});
return;
}
DebugOutput.PrintLn(message);
if (OutputBox.InvokeRequired)
OutputBox.Invoke(new Action(() =>
{
OutputBox.AppendText(message + Environment.NewLine);
OutputBox.ScrollToCaret();
}));
else
{
OutputBox.AppendText(message + Environment.NewLine);
OutputBox.ScrollToCaret();
}
}