Esempio n. 1
0
 static private void _ProgressFormClose(object state)
 {
     try
     {
         #region Exit when progress form does not created
         if (_lck_progress_open == 0)
         {
             return;
         }
         #endregion
         #region One Close when progress form is loaded
         int ret = Interlocked.CompareExchange(ref _lck_progress_close, 1, 0);
         if (ret == 0)
         {
             _progress_form = null;
             if (_owner_form != null && !_owner_form.IsDisposed)
             {
                 _owner_form.Activate();
             }
         }
         #endregion
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 2
0
        static private void _ProgressFormShow(object state)
        {
            try
            {
                object[] param    = (object[])state;
                string   title    = Convert.ToString(param[0]);
                string   taskname = Convert.ToString(param[1]);
                Form     owner    = (Form)param[2];

                if (_progress_form == null)
                {
                    _progress_form = new FormDictProgress();
                    _progress_form.SetProgress(title, taskname);

                    _owner_form = owner;
                    _progress_form.ShowDialog();
                }
                else
                {
                    _progress_form.SetProgress(title, taskname);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                MessageBox.Show(ex.ToString());
            }
        }