Example #1
0
        public BusyDialog(string message, ProcessingHandler handler, object parameter)
        {
            InitializeComponent();
            lblMessage.Text = message;
            _handler = handler;
            _parameter = parameter;

            if (_icons == null)
            {
                _icons = new Bitmap[8];
                for (int i = 0; i < _icons.Length; i++)
                {
                    _icons[i] = Resources.ResourceManager.GetIcon("busy_blue-circle_" + (i + 1) + ".ico").ToBitmap();
                }
            }
        }
Example #2
0
        public BusyDialog(string message, ProcessingHandler handler, object parameter)
        {
            InitializeComponent();
            lblMessage.Text = message;
            _handler        = handler;
            _parameter      = parameter;

            if (_icons == null)
            {
                _icons = new Bitmap[8];
                for (int i = 0; i < _icons.Length; i++)
                {
                    _icons[i] = Resources.ResourceManager.GetIcon("busy_blue-circle_" + (i + 1) + ".ico").ToBitmap();
                }
            }
        }
Example #3
0
        public static object Show(string message, ProcessingHandler handler, object parameter)
        {
            object     resultToReturn = null;
            BusyDialog dialog         = new BusyDialog(message, handler, parameter);

            try
            {
                dialog.ShowDialog();
                resultToReturn = dialog.Result;
                if (dialog.ExceptionThrown != null)
                {
                    // Re-throw the same type of exception
                    ConstructorInfo constructor = dialog.ExceptionThrown.GetType().GetConstructor(new Type[] { dialog.ExceptionThrown.GetType() });
                    if (constructor != null)
                    {
                        // Copy constructor
                        throw (Exception)constructor.Invoke(new object[] { dialog.ExceptionThrown });
                    }
                    else
                    {
                        constructor = dialog.ExceptionThrown.GetType().GetConstructor(new Type[] { typeof(string), typeof(Exception) });
                        if (constructor == null)
                        {
                            // default constructor
                            throw new AGSEditorException(dialog.ExceptionThrown.Message, dialog.ExceptionThrown);
                        }
                        else
                        {
                            throw (Exception)constructor.Invoke(new object[] { dialog.ExceptionThrown.Message, dialog.ExceptionThrown });
                        }
                    }
                }
            }
            finally
            {
                dialog.Dispose();
            }
            return(resultToReturn);
        }
Example #4
0
 public static object Show(string message, ProcessingHandler handler, object parameter)
 {
     object resultToReturn = null;
     BusyDialog dialog = new BusyDialog(message, handler, parameter);
     try
     {
         dialog.ShowDialog();
         resultToReturn = dialog.Result;
         if (dialog.ExceptionThrown != null)
         {
             // Re-throw the same type of exception
             ConstructorInfo constructor = dialog.ExceptionThrown.GetType().GetConstructor(new Type[] { dialog.ExceptionThrown.GetType() });
             if (constructor != null)
             {
                 // Copy constructor
                 throw (Exception)constructor.Invoke(new object[] { dialog.ExceptionThrown });
             }
             else
             {
                 constructor = dialog.ExceptionThrown.GetType().GetConstructor(new Type[] { typeof(string), typeof(Exception) });
                 if (constructor == null)
                 {
                     // default constructor
                     throw new AGSEditorException(dialog.ExceptionThrown.Message, dialog.ExceptionThrown);
                 }
                 else
                 {
                     throw (Exception)constructor.Invoke(new object[] { dialog.ExceptionThrown.Message, dialog.ExceptionThrown });
                 }
             }
         }
     }
     finally
     {
         dialog.Dispose();
     }
     return resultToReturn;
 }