void pgn_OnProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     if (progressForm != null)
     {
         if (!isTotalGameCountSet)
         {
             progressForm.ProgressBar.Maximum = totalGamesCount;
             isTotalGameCountSet = true;
         }
         progressForm.ProgressBar.Show();
         progressForm.ProgressBar.Refresh();
         progressForm.ProgressBar.Value = e.ProgressPercentage;
         progressForm.GameNo.Text       = "Game " + e.ProgressPercentage.ToString() + " of " + totalGamesCount.ToString();
         string percentage = Math.Round((((double)e.ProgressPercentage / totalGamesCount) * 100)).ToString();
         progressForm.Percentage.Text = percentage + "%";
     }
     else
     {
         progressForm                   = new GameSearchProgress();
         progressForm.Text              = "File Conversion";
         progressForm.OnWorkCancelled  += new GameSearchProgress.WorkCancelledHandler(pgnProgressForm_OnWorkCancelled);
         progressForm.TimeConsumed.Text = "Estimating Game Count....";
         progressForm.Show();
     }
 }
 void pgn_OnProgressWorkCompleted(object sender, ProgressWorkCompletedEventArgs e)
 {
     if (progressForm != null)
     {
         progressForm.Timer.Stop();
         if (e.arguments.Cancelled)
         {
             MessageForm.Show(this, MsgE.ConversionCancelled);
         }
         if (!e.arguments.Cancelled)
         {
             MessageForm.Show(this, MsgE.ConversionCompleted);
             progressForm.OnWorkCancelled -= new GameSearchProgress.WorkCancelledHandler(pgnProgressForm_OnWorkCancelled);
         }
         progressForm.Close();
         progressForm = null;
     }
 }
 void Icd_OnProgressWorkCompleted(object sender, ProgressWorkCompletedEventArgs e)
 {
     if (progressForm != null)
     {
         progressForm.Timer.Stop();
         if (e.arguments.Cancelled)
         {
             MessageForm.Show(this, MsgE.ConversionCancelled);
         }
         if (!e.arguments.Cancelled)
         {
             MessageForm.Show(this, MsgE.ConversionCompleted);
             progressForm.OnWorkCancelled -= new GameSearchProgress.WorkCancelledHandler(IcdProgressForm_OnWorkCancelled);
         }
         using (StreamWriter outfile =
                    new StreamWriter(fileName.Replace(".icd", ".pgn")))
         {
             outfile.Write(e.data);
         }
         progressForm.Close();
         progressForm = null;
     }
 }