示例#1
0
 /// /////////////////////////////////////////////////////////////////
 public static void StartThreadWithProgress(string strTitre, ThreadStart fonctionDemarrage, bool bWaitEnd)
 {
     if (m_form == null)
     {
         m_form = new CFormProgressTimos();
     }
     m_form.ResetSegmentsProgression();
     m_form.TopMost = true;
     m_form.BringToFront();
     m_form.m_labelInfo.Text = strTitre;
     m_form.Show();
     m_form.TopMost = false;
     m_form.Refresh();
     if (bWaitEnd)
     {
         try
         {
             Thread th = new Thread(fonctionDemarrage);
             th.SetApartmentState(ApartmentState.STA);
             th.Start();
             th.Join();
         }
         catch {}
         try
         {
             m_form.Hide();
         }
         catch
         { }
     }
     else
     {
         fonctionDemarrage.BeginInvoke(new AsyncCallback(m_form.OnEndProcess), null);
     }
 }
        /// ///////////////////////////////////////////////
        public IIndicateurProgression GetNewIndicateurAndPopup( )
        {
            Thread th = new Thread(new ThreadStart(StartPopup));

            m_lastForm = null;
            th.Start();
            while (m_lastForm == null)
            {
                Thread.Sleep(100);
            }
            return(m_lastForm);
        }
示例#3
0
 /// /////////////////////////////////////////////////////////////////
 private void OnEndProcess(IAsyncResult result)
 {
     if (IsHandleCreated)
     {
         Invoke((MethodInvoker) delegate
         {
             ResetSegmentsProgression();
             Close();
             m_form = null;
         });
     }
 }
 //////////////////////////////////////////////////////
 private void m_lnkExecuter_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
 {
     CFormProgressTimos.StartThreadWithProgress(I.T("Planned task |30234") + TachePlanifiee.Libelle, new System.Threading.ThreadStart(StartAction), false);
 }
 private void StartPopup()
 {
     m_lastForm         = new CFormProgressTimos();
     m_lastForm.TopMost = true;
     m_lastForm.ShowDialog();
 }