/// <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(); }
/// <summary> /// ResetStyles method. /// </summary> /// <param name="styleManager">ModernStyleManager instance.</param> /// <param name="control">Control to reset.</param> private void ResetStyles(ModernStyleManager styleManager, Control control) { IModernForm container = control as IModernForm; if (container != null && !object.ReferenceEquals(styleManager, container.StyleManager)) { return; } if (control is IModernControl) { this.ResetProperty(control, "Style", ModernColorStyle.Default); this.ResetProperty(control, "Theme", ModernThemeStyle.Default); } else if (control is IModernComponent) { this.ResetProperty(control, "Style", ModernColorStyle.Default); this.ResetProperty(control, "Theme", ModernThemeStyle.Default); } if (control.ContextMenuStrip != null) { this.ResetStyles(styleManager, control.ContextMenuStrip); } TabControl tabControl = control as TabControl; if (tabControl != null) { foreach (TabPage item in tabControl.TabPages) { this.ResetStyles(styleManager, item); } } if (control.Controls != null) { foreach (Control item in control.Controls) { this.ResetStyles(styleManager, item); } } }