/// <summary>
    ///   Shows the progress reporter until the specified transaction has ended.
    /// </summary>
    /// <param name="windowTitle">
    ///   Text to be shown in the progress reporter's title bar
    /// </param>
    /// <param name="transaction">
    ///   Process for whose duration to show the progress reporter
    /// </param>
    public static void Track(string windowTitle, Transaction transaction) {

      // Small optimization to avoid the lengthy control creation when the background
      // process has already ended. This is an accepted race condition: If the process
      // finishes right after this line, it doesn't change the outcome, it just
      // causes the progress dialog to be constructed needlessly.
      if(transaction.Ended)
        return;

      // Open the form and let it monitor the transaction's state
      using(ProgressReporterForm theForm = new ProgressReporterForm()) {
        theForm.track(windowTitle, transaction);
      }

    }
예제 #2
0
        /// <summary>
        ///   Shows the progress reporter until the specified transaction has ended.
        /// </summary>
        /// <param name="windowTitle">
        ///   Text to be shown in the progress reporter's title bar
        /// </param>
        /// <param name="transaction">
        ///   Process for whose duration to show the progress reporter
        /// </param>
        public static void Track(string windowTitle, Transaction transaction)
        {
            // Small optimization to avoid the lengthy control creation when the background
            // process has already ended. This is an accepted race condition: If the process
            // finishes right after this line, it doesn't change the outcome, it just
            // causes the progress dialog to be constructed needlessly.
            if (transaction.Ended)
            {
                return;
            }

            // Open the form and let it monitor the transaction's state
            using (ProgressReporterForm theForm = new ProgressReporterForm()) {
                theForm.track(windowTitle, transaction);
            }
        }