public void launch_EAD_generator(IDbConnection connection, long IDNivel_PAI, long IDNivel, string FileName, Control TopLevelControl) {
            string mFileName = FileNameSelection(FileName);
            if (mFileName != null && !mFileName.Equals("")) {

                long ceiling = (long)(EADGeneratorRule.Current.get_Count_All_NiveisDescendentes(IDNivel, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID, connection) / 2);

                progressBar = new DoubleProgressBar();
                progressBar.Dock = DockStyle.Fill;
                progressBar.ShowCurrent = false;
                progressBar.Current = 0;
                progressBar.Maximum = 0;
                progressBar.Ceiling = (ceiling > 0 ? ceiling : 1);

                progressDialog = new Form();
                progressDialog.Size = new Size(320, 82);
                progressDialog.FormBorderStyle = FormBorderStyle.FixedDialog;
                progressDialog.ControlBox = false;
                progressDialog.ShowInTaskbar = false;
                progressDialog.Text = "Geração de EAD:" + mFileName + "...";
                progressDialog.StartPosition = FormStartPosition.CenterParent;
                progressDialog.Controls.Add(progressBar);
                progressDialog.DockPadding.All = 16;

                this.IDNivel_PAI = IDNivel_PAI;
                this.IDNivel = IDNivel;
                this.the_EADGenerator = new EADGenerator(mFileName, connection);

                Thread th = new Thread(new System.Threading.ThreadStart(this.EAD_Runner));
                th.Start();
                progressDialog.ShowDialog(TopLevelControl);
            }
        }
 public BackgroundRunner(Control TopLevelControl, Relatorio relatorio, long Ceiling)
 {
     if (relatorio.GetFileName != null)
     {
         progressBar = new DoubleProgressBar();
         progressBar.Dock = DockStyle.Fill;
         progressBar.Current = 0;
         progressBar.Maximum = 0;
         progressBar.Ceiling = Ceiling;
         progressDialog = new Form();
         progressDialog.Size = new Size(320, 82);
         progressDialog.FormBorderStyle = FormBorderStyle.FixedDialog;
         progressDialog.ControlBox = false;
         progressDialog.ShowInTaskbar = false;
         progressDialog.Text = "A gerar documento...";
         progressDialog.StartPosition = FormStartPosition.CenterParent;
         progressDialog.Controls.Add(progressBar);
         progressDialog.DockPadding.All = 16;
         this.rel = relatorio;
         Thread th = new Thread(new System.Threading.ThreadStart(this.RunReport));
         th.Start();
         progressDialog.ShowDialog(TopLevelControl);
     }
 }