title: Progress bar for an external process
body: <p>I'm currently writing a lightweight program that consolidates many command line and other external processes into one application.</p>
  
  <p>Currently, I am faced with the challenge of pulling system information using the <em>system info</em> process.</p>
  
  <p>I have successfully coded the button to call the system info process, and redirect the output to a text field.</p>
  
  <p>What I am now attempting is to have a progress bar at the bottom of my WPF window, since it takes a moment to load the system information.</p>
  
  <p>Since I don't know of a way to get an accurate duration from an external process, I am attempting to use the Marquee style.</p>
  
  <p>I've been following examples here on stackoverflow (<a href="https://stackoverflow.com/questions/312936/windows-forms-progressbar-easiest-way-to-start-stop-marquee">Windows Forms ProgressBar: Easiest way to start/stop marquee?</a>), as well as other sites, but haven't been able to determine where to put the code so that the progress bar scrolls while systeminfo is running and stops when it is finished.</p>
  
  <p>My current code (without the <code>progressbar1.Style = ProgressBarStyle.Marquee;</code>) is below.</p>
  
  <p>Any suggestions as to where to place the code, or what syntax to use would be greatly appreciated.  Thank you in advance!</p>
  
  <pre><code>private void btnSystemInfo_Click(object sender, RoutedEventArgs e)
          {
  
  
              // Get system info
              Process info = new Process();
              info.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
              info.StartInfo.FileName = "C:\\Windows\\system32\\systeminfo.exe";
              info.StartInfo.Arguments = "-S " + context;
              info.StartInfo.UseShellExecute = false;
              info.StartInfo.CreateNoWindow = true;
              info.StartInfo.RedirectStandardOutput = true;
  
              info.Start();
  
              string infoOutput = info.StandardOutput.ReadToEnd();
              info.WaitForExit();
  
              // Write to the txtInfo text box
              txtInfo.Text = "System Info: " + infoOutput;
              txtInfo.Foreground = Brushes.Black;
              txtInfo.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
  
              // Switch to the info tab
              tabControl.SelectedIndex = 3;
          }
  </code></pre>