I use the following code to start an external programm in the command prompt:
private void GenerateTiff(String fileName) {
bool success = true;
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += delegate
{
try
{
String cmd = @"./lib/gswin32c";
String args = "-dNOPAUSE -sDEVICE=pngalpha -r300 -dBATCH -dSAFER -sOutputFile=" + fileName + "-%03d" + FILEEXTENSION + " " + fileName + ".pdf";
Process proc = new Process();
proc.StartInfo.FileName = cmd;
proc.StartInfo.Arguments = args;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();
}
catch (Exception e)
{
success = false;
}
};
worker.RunWorkerCompleted += delegate
{
string file = fileName + "-001.jpg";
if (success) {
DisplayImage.Visibility = System.Windows.Visibility.Visible;
DisplayImage.Tag = fileName;
}
};
worker.RunWorkerAsync();
}
Now I'd like to read the log of the command prompt. How can I do that?