Exemplo n.º 1
0
 void Database_OnProgressWorkCompleted(object sender, ProgressWorkCompletedEventArgs e)
 {
     if (progressForm != null)
     {
         progressForm.Timer.Stop();
         if (e.arguments.Cancelled)
         {
             MessageForm.Show(this, MsgE.SearchingCancelled);
         }
         if (!e.arguments.Cancelled)
         {
             MessageForm.Show(this, MsgE.SearchingCompleted);
             progressForm.OnWorkCancelled -= new GameSearchProgress.WorkCancelledHandler(progressForm_OnWorkCancelled);
         }
         progressForm.Close();
         progressForm = null;
         UnregisterEventHandlers();
         DataBind(e.SearchedGames);
     }
 }
Exemplo n.º 2
0
        void Database_OnProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            if (e.ProgressPercentage == -1 && waitingForm == null)
            {
                waitingForm = new ProgressForm();
                waitingForm.ProgressText  = "Please Wait......";
                waitingForm.ControlBox    = false;
                waitingForm.Text          = "  ";
                waitingForm.StartPosition = FormStartPosition.CenterScreen;
                waitingForm.Show(this);
            }
            else
            {
                if (e.ProgressPercentage != -1 && waitingForm != null)
                {
                    waitingForm.Close();
                }

                if (progressForm != null)
                {
                    progressForm.ProgressBar.Show();
                    progressForm.ProgressBar.Refresh();
                    progressForm.ProgressBar.Value = e.ProgressPercentage;
                    progressForm.GameNo.Text       = "Game " + e.ProgressPercentage.ToString();
                    string percentage = Math.Round((((double)e.ProgressPercentage / TotalGames) * 100)).ToString();
                    progressForm.Percentage.Text = percentage + "%";
                }
                else
                {
                    progressForm                     = new GameSearchProgress();
                    progressForm.Text                = "Searching Games....";
                    progressForm.OnWorkCancelled    += new GameSearchProgress.WorkCancelledHandler(progressForm_OnWorkCancelled);
                    progressForm.ProgressBar.Maximum = TotalGames;
                    progressForm.ShowDialog(this);
                }
            }
        }