Example #1
0
        public static void ApplyMetroStyle(IMetroForm form)
        {
            if (form == null)
                return;

            form.StyleManager = MANAGER;
            Control legacyForm = form as Form;
            if (legacyForm != null)
                legacyForm.Disposed += new EventHandler(legacyForm_Disposed);
        }
        public static void ApplyMetroStyle(IMetroForm form)
        {
            if (form == null)
            {
                return;
            }

            form.StyleManager = MANAGER;
            Control legacyForm = form as Form;

            if (legacyForm != null)
            {
                legacyForm.Disposed += new EventHandler(legacyForm_Disposed);
            }
        }
        private static void legacyForm_Disposed(object sender, EventArgs e)
        {
            IMetroForm form = sender as IMetroForm;

            if (form != null)
            {
                form.StyleManager = null;
            }

            Form legacyForm = sender as Form;

            if (legacyForm != null)
            {
                legacyForm.Disposed -= new EventHandler(legacyForm_Disposed);
            }
        }
        private void ResetStyles(MetroStyleManager styleManager, Control control)
        {
            IMetroForm container = control as IMetroForm;

            if (container != null && !ReferenceEquals(styleManager, container.StyleManager))
            {
                return;
            }

            if (control is IMetroControl)
            {
                ResetProperty(control, "Style", MetroColorStyle.Default);
                ResetProperty(control, "Theme", MetroThemeStyle.Default);
            }
            else if (control is IMetroComponent)
            {
                ResetProperty(control, "Style", MetroColorStyle.Default);
                ResetProperty(control, "Theme", MetroThemeStyle.Default);
            }

            if (control.ContextMenuStrip != null)
            {
                ResetStyles(styleManager, control.ContextMenuStrip);
            }

            TabControl tabControl = control as TabControl;

            if (tabControl != null)
            {
                foreach (TabPage tp in tabControl.TabPages)
                {
                    ResetStyles(styleManager, tp);
                }
            }

            if (control.Controls != null)
            {
                foreach (Control child in control.Controls)
                {
                    ResetStyles(styleManager, child);
                }
            }
        }
Example #5
0
        // Token: 0x0600040D RID: 1037 RVA: 0x0000E094 File Offset: 0x0000C294
        public static void ShowTaskWindow(IWin32Window parent, string title, Control userControl, int secToClose)
        {
            if (MetroTaskWindow.singletonWindow != null)
            {
                MetroTaskWindow.singletonWindow.Close();
                MetroTaskWindow.singletonWindow.Dispose();
                MetroTaskWindow.singletonWindow = null;
            }
            MetroTaskWindow.singletonWindow               = new MetroTaskWindow(secToClose, userControl);
            MetroTaskWindow.singletonWindow.Text          = title;
            MetroTaskWindow.singletonWindow.Resizable     = false;
            MetroTaskWindow.singletonWindow.StartPosition = FormStartPosition.Manual;
            IMetroForm metroForm = parent as IMetroForm;

            if (metroForm != null && metroForm.StyleManager != null)
            {
                ((IMetroStyledComponent)MetroTaskWindow.singletonWindow.metroStyleManager).InternalStyleManager = metroForm.StyleManager;
            }
            MetroTaskWindow.singletonWindow.Show(parent);
        }
        private void ResetStyles(MetroStyleManager styleManager, Control control)
        {
            IMetroForm metroForm = control as IMetroForm;

            if (metroForm != null && !object.ReferenceEquals(styleManager, metroForm.StyleManager))
            {
                return;
            }
            if (control is IMetroControl)
            {
                this.ResetProperty(control, "Style", MetroColorStyle.Default);
                this.ResetProperty(control, "Theme", MetroThemeStyle.Default);
            }
            else if (control is IMetroComponent)
            {
                this.ResetProperty(control, "Style", MetroColorStyle.Default);
                this.ResetProperty(control, "Theme", MetroThemeStyle.Default);
            }
            if (control.ContextMenuStrip != null)
            {
                this.ResetStyles(styleManager, control.ContextMenuStrip);
            }
            TabControl tabControl = control as TabControl;

            if (tabControl != null)
            {
                foreach (TabPage tabPage in tabControl.TabPages)
                {
                    this.ResetStyles(styleManager, tabPage);
                }
            }
            if (control.Controls != null)
            {
                foreach (Control control1 in control.Controls)
                {
                    this.ResetStyles(styleManager, control1);
                }
            }
        }