Ejemplo n.º 1
0
        /// <summary>
        /// Shows the task window.
        /// </summary>
        /// <param name="owner">The parent.</param>
        /// <param name="text">The text.</param>
        /// <param name="autoCloseTime">The auto close window duration in milliseconds.</param>
        /// <param name="userControl">The user control.</param>
        public static void Show(IWin32Window owner, string text, long autoCloseTime, Control userControl)
        {
            if (SingletonWindow != null)
            {
                SingletonWindow.Close();
                SingletonWindow.Dispose();
                SingletonWindow = null;
            }

            SingletonWindow               = new ModernTaskWindow(autoCloseTime, userControl);
            SingletonWindow.Text          = text;
            SingletonWindow.StartPosition = FormStartPosition.Manual;
            SingletonWindow.Location      = new Point(Screen.PrimaryScreen.Bounds.Width - 400 - 5, Screen.PrimaryScreen.Bounds.Height - 200 - 5);

            IModernForm ownerForm = null;

            if (owner != null)
            {
                ownerForm = owner as IModernForm;
            }
            else
            {
                ownerForm = Form.ActiveForm as IModernForm;
            }

            if (ownerForm != null)
            {
                SingletonWindow.ThemeStyle   = ownerForm.ThemeStyle;
                SingletonWindow.ColorStyle   = ownerForm.ColorStyle;
                SingletonWindow.StyleManager = ownerForm.StyleManager.Clone(SingletonWindow) as ModernStyleManager;
            }

            SingletonWindow.Show();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Closing" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.ComponentModel.CancelEventArgs" /> that contains the event data.</param>
        protected override void OnClosing(CancelEventArgs e)
        {
            if (!(this is ModernTaskWindow))
            {
                ModernTaskWindow.ForceClose();
            }

            base.OnClosing(e);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Forces the close.
 /// </summary>
 public static void ForceClose()
 {
     if (_singletonWindow != null)
     {
         CancelAutoClose();
         _singletonWindow.Close();
         _singletonWindow.Dispose();
         _singletonWindow = null;
     }
 }