Exemplo n.º 1
0
 internal AccountControl(MetroTabControl tabControl, int totalCount, int activeCount, int newSet,
     MetroStyleManager styleManager, Account account)
 {
     _account = account;
     FixControls(newSet, styleManager, account);
     AddControlsToForm(tabControl, styleManager, activeCount, newSet);
     ID = totalCount;
     BindEvents();
 }
Exemplo n.º 2
0
        public object Clone()
        {
            MetroStyleManager metroStyleManager = new MetroStyleManager()
            {
                metroTheme = this.Theme,
                metroStyle = this.Style
            };

            return(metroStyleManager);
        }
        public object Clone()
        {
            MetroStyleManager newStyleManager = new MetroStyleManager
            {
                metroTheme = Theme,
                metroStyle = Style
            };

            return(newStyleManager);
        }
        public object Clone()
        {
            MetroStyleManager newStyleManager = new MetroStyleManager();

            newStyleManager.metroTheme = this.Theme;
            newStyleManager.metroStyle = this.Style;
            newStyleManager.ownerForm  = null;

            return(newStyleManager);
        }
Exemplo n.º 5
0
        public object Clone(ContainerControl owner)
        {
            MetroStyleManager clonedManager = Clone() as MetroStyleManager;

            if (owner is IMetroForm)
            {
                clonedManager.Owner = owner;
            }

            return(clonedManager);
        }
Exemplo n.º 6
0
        public static void SetStyle(this IContainer container, MetroForm ownerForm)
        {
            if (container == null)
            {
                container = new System.ComponentModel.Container();
            }
            var manager = new MetroFramework.Components.MetroStyleManager(container);

            manager.Owner = ownerForm;
            container.SetDefaultStyle(ownerForm, FormStyle);
        }
Exemplo n.º 7
0
 public TvShowTile(MetroStyleManager styleManager, bool AddContextStrip = false)
 {
     InitializeComponent();
     tile.StyleManager = styleManager;
     label1.StyleManager = styleManager;
     ctxMenuStrip.StyleManager = styleManager;
     if (AddContextStrip)
     {
         this.ContextMenuStrip = ctxMenuStrip;
     }
     frmMain.Frm.StyleChanged += Frm_StyleChanged;
 }
Exemplo n.º 8
0
 public MetroStyleManager()
 {
     _styleManager = Default;
     if (_styleManager != null)
     {
         _styleManager.MetroStyleChanged += OnMetroStyleChanged;
     }
     else // we are the singleton instance - provide actual defaults here
     {
         _metroTheme = Styles.DefaultTheme.Name;
         _metroStyle = Styles.DefaultStyle.Name;
     }
 }
Exemplo n.º 9
0
 internal SchedulerForm(MainForm mainForm, AccountClass account, MetroStyleManager styleManager)
 {
     InitializeComponent(styleManager.Theme, styleManager.Style);
     _account = account;
     _form = mainForm;
     StyleManager = styleManager;
     SetControlText(account);
     SetTimeFields();
     numericUpDown1.Value = 0;
     BindEvents();
     numericUpDown1.ReadOnly = true;
     SetTotalValue();
     UpdateFormAppearance(styleManager);
 }
 public MetroMessageDialog(string message, MetroStyleManager ms)
 {
     InitializeComponent();
     this.StyleManager = new MetroStyleManager();
     this.StyleManager.Owner = this;
     this.StyleManager.Theme = ms.Theme;
     this.StyleManager.Style = ms.Style;
     this.ShadowType = MetroFormShadowType.SystemDropShadow;
     this.BorderStyle = MetroFramework.Drawing.MetroBorderStyle.None;
     richTextBoxMessage.Font = this.StyleManager.GetThemeFont(MetroFramework.Drawing.MetroFontSize.Medium, MetroFramework.Drawing.MetroFontWeight.Regular);
     richTextBoxMessage.Text = message;
     richTextBoxMessage.Enter += delegate(object s, EventArgs eA){
         richTextBoxMessage.DeselectAll();
         metroButtonOk.Focus();
     };
 }      
Exemplo n.º 11
0
 internal ManageBreaks(AccountClass account, MetroStyleManager styleManager)
 {
     InitializeComponent();
     _account = account;
     StyleManager = styleManager;
     UpdateFormAppearance(styleManager);
     Scheduler wanted =
         Config.Singleton.SchedulerSettings.FirstOrDefault(s => s.Account.LoginName == _account.LoginName);
     if (wanted != null)
     {
         numericUpDown1.Value = (decimal) wanted.BreakObject.TimeSpanInterval.TotalMinutes;
         numericUpDown2.Value = (decimal) wanted.BreakObject.TimeSpanToAddToLastBreak.TotalMinutes;
         numericUpDown3.Value = (decimal) wanted.BreakObject.TimeSpanToPause.TotalMinutes;
         numericUpDown4.Value = (decimal) wanted.BreakObject.TimeSpanToWaitLonger.TotalMinutes;
         chkBoxEnableBreak.Checked = wanted.BreakObject.BreakEnabled;
     }
 }
Exemplo n.º 12
0
        public static MetroStyleManager GetNewManager(IMetroContainerControl owner)
        {
            if (_DefaultStyleManager == null)
            {
                _DefaultStyleManager = new MetroStyleManager();
                _DefaultStyleManager.Style = MetroFramework.MetroColorStyle.Green;
                _DefaultStyleManager.Theme = MetroFramework.MetroThemeStyle.Dark;
            }

            MetroStyleManager newManager = new MetroStyleManager();
            newManager.Style = _DefaultStyleManager.Style;
            newManager.Theme = _DefaultStyleManager.Theme;
            newManager.Owner = owner;

            _Managers.Add(owner, newManager);

            return newManager;
        }
Exemplo n.º 13
0
        public object Clone(ContainerControl owner)
        {
            MetroStyleManager clonedManager = Clone() as MetroStyleManager;

            if (owner is IMetroForm)
            {
                clonedManager.Owner = owner;
                ((IMetroForm)owner).StyleManager = clonedManager;

                Type      parentForm = owner.GetType();
                FieldInfo fieldInfo  = parentForm.GetField("components",
                                                           BindingFlags.Instance |
                                                           BindingFlags.NonPublic);

                if (fieldInfo == null)
                {
                    return(clonedManager);
                }

                IContainer mother = (IContainer)fieldInfo.GetValue(owner);
                if (mother == null)
                {
                    return(clonedManager);
                }

                // Check for a helper component
                foreach (Component obj in mother.Components)
                {
                    if (obj is IMetroComponent)
                    {
                        ApplyTheme((IMetroComponent)obj);
                    }

                    if (obj.GetType() == typeof(MetroContextMenu))
                    {
                        ApplyTheme((MetroContextMenu)obj);
                    }
                }
            }

            return(clonedManager);
        }
Exemplo n.º 14
0
        public static void SetStyle(this IContainer container, MetroForm ownerForm)
        {
            if (!File.Exists(Program.SettingsJsonFile))
            {
                File.WriteAllText(Program.SettingsJsonFile, "{}");
            }

            var Settingslist = JsonConvert.DeserializeObject <ChatLoggerSettings>(File.ReadAllText(Program.SettingsJsonFile));

            FormStyle = (MetroFramework.MetroColorStyle)Convert.ToUInt32(Settingslist.startupColor);

            if (container == null)
            {
                container = new System.ComponentModel.Container();
            }
            var manager = new MetroFramework.Components.MetroStyleManager(container);

            manager.Owner = ownerForm;
            container.SetDefaultStyle(ownerForm, FormStyle);
        }
Exemplo n.º 15
0
        private void AddControlsToForm(MetroTabControl tabControl, MetroStyleManager styleManager, int activeCount,
            int newSet)
        {
            TabPage page = tabControl.TabPages[tabControl.TabPages.Count - 1];
            var newPage = new MetroTabPage
            {
                BackColor = Color.Transparent,
                Text = string.Format("{0}-{1}", activeCount + 2, activeCount + 11),
            };
            if (newSet == 10 && tabControl.TabPages.Count < 10)
                tabControl.TabPages.Add(newPage);
            newPage.Controls.Add(new MetroLabel
            {
                FontWeight = MetroFontWeight.Bold,
                Text = LanguageManager.Singleton.GetTranslation(ETranslations.AccountControlLoginName),
                Theme = styleManager.Theme,
                Style = styleManager.Style,
                Location = new Point(3, 10),
                BackColor = Color.Transparent,
            });
            newPage.Controls.Add(new MetroLabel
            {
                FontWeight = MetroFontWeight.Bold,
                Text = LanguageManager.Singleton.GetTranslation(ETranslations.AccountControlStatus),
                Theme = styleManager.Theme,
                Style = styleManager.Style,
                Location = new Point(490, 10),
                BackColor = Color.Transparent,
            });

            page.Controls.Add(LblAccountName);
            page.Controls.Add(BtnStart);
            page.Controls.Add(BtnKill);
            page.Controls.Add(BtnManage);
            page.Controls.Add(LblStatus);
            page.Controls.Add(CmbSettings);
            page.Controls.Add(BtnSettings);
            page.Controls.Add(BtnResetTime);
        }
Exemplo n.º 16
0
 public FixedStyleManager(MetroForm form)
 {
     this.m_manager = new MetroStyleManager(form.Container);
     this.m_manager.Owner = form;
 }
 public MetroStyleExtender()
 {
     _styleManager = new MetroStyleManager();
     _styleManager.MetroStyleChanged += OnMetroStyleChanged;
 }
Exemplo n.º 18
0
        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);
                }
            }
        }
Exemplo n.º 19
0
 public MetroStyleExtender()
 {
     _styleManager = new MetroStyleManager();
     _styleManager.MetroStyleChanged += OnMetroStyleChanged;
 }
Exemplo n.º 20
0
 protected MetroToolTipBase()
 {
     _styleManager = new MetroStyleManager();
     _styleManager.MetroStyleChanged += OnMetroStyleChanged;
 }
        private void ResetStyles(MetroStyleManager styleManager, Control control)
        {
            // Skip container controls with a dedicated style manager component
            IMetroContainerControl container = control as IMetroContainerControl;
            if (container != null && ! ReferenceEquals(styleManager, container.StyleManager)) return;

             if (control is IMetroStyledComponent)
            {
                ResetProperty(control, MetroStyleManager.THEME_PROPERTY_NAME, MetroStyleManager.AMBIENT_VALUE);
                ResetProperty(control, MetroStyleManager.STYLE_PROPERTY_NAME, MetroStyleManager.AMBIENT_VALUE);
            }

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

            // descend into tab pages
            TabControl tabControl = control as TabControl;
            if (tabControl != null) foreach (TabPage tp in tabControl.TabPages) ResetStyles(styleManager, tp);

            // descend into child controls
            if (control.Controls != null) foreach (Control child in control.Controls) ResetStyles(styleManager, child);
        }
Exemplo n.º 22
0
 protected MetroComponentBase()
 {
     _styleManager = new MetroStyleManager();
     _styleManager.MetroStyleChanged += OnMetroStyleChanged;
 }
Exemplo n.º 23
0
        public object Clone()
        {
            MetroStyleManager newStyleManager = new MetroStyleManager();
            newStyleManager.metroTheme = this.Theme;
            newStyleManager.metroStyle = this.Style;
            newStyleManager.ownerForm = null;

            return newStyleManager;
        }
 public object Clone()
 {
     MetroStyleManager newStyleManager = new MetroStyleManager();
     newStyleManager.metroTheme = Theme;
     newStyleManager.metroStyle = Style;
     return newStyleManager;
 }
Exemplo n.º 25
0
 private void UpdateFormAppearance(MetroStyleManager styleManager)
 {
     metroStyleManager.Style = styleManager.Style;
     metroStyleManager.Theme = styleManager.Theme;
     metroStyleManager.UpdateOwnerForm();
 }
Exemplo n.º 26
0
 private void FixControls(int newSet, MetroStyleManager styleManager, Account account)
 {
     LblAccountName.Theme = styleManager.Theme;
     LblAccountName.Style = styleManager.Style;
     LblAccountName.Text = account.LoginName;
     LblAccountName.Width = 280;
     LblAccountName.BackColor = Color.Transparent;
     BtnStart.Theme = styleManager.Theme;
     BtnStart.Style = styleManager.Style;
     BtnStart.Text = LanguageManager.Singleton.GetTranslation(ETranslations.AccountControlStart);
     BtnKill.Theme = styleManager.Theme;
     BtnKill.Style = styleManager.Style;
     BtnKill.Text = LanguageManager.Singleton.GetTranslation(ETranslations.AccountControlStop);
     BtnManage.Theme = styleManager.Theme;
     BtnManage.Style = styleManager.Style;
     BtnManage.Text = LanguageManager.Singleton.GetTranslation(ETranslations.AccountControlManage);
     BtnSettings.Theme = styleManager.Theme;
     BtnSettings.Style = styleManager.Style;
     BtnSettings.Text = LanguageManager.Singleton.GetTranslation(ETranslations.AccountControlSettings);
     BtnResetTime.Theme = styleManager.Theme;
     BtnResetTime.Style = styleManager.Style;
     BtnResetTime.Text = "Reset Delay";
     LblStatus.Theme = styleManager.Theme;
     LblStatus.Style = styleManager.Style;
     LblStatus.Text =
         LanguageManager.Singleton.GetTranslation(account.ShouldBeRunning
             ? ETranslations.AccountControlEnabled
             : ETranslations.AccountControlDisabled);
     LblStatus.BackColor = Color.Transparent;
     CmbSettings.Theme = styleManager.Theme;
     CmbSettings.Style = styleManager.Style;
     int heightPosition = (newSet)*40;
     LblAccountName.Location = new Point(3, heightPosition + 3);
     BtnStart.Width = 53;
     BtnStart.Height = 23;
     BtnKill.Width = 46;
     BtnKill.Height = 23;
     BtnResetTime.Height = 23;
     BtnSettings.Width = 75;
     BtnSettings.Height = 23;
     CmbSettings.Width = 153;
     CmbSettings.Height = 29;
     LblStatus.Width = 70;
     BtnStart.Location = new Point(290, heightPosition);
     BtnKill.Location = new Point(349, heightPosition);
     BtnManage.Location = new Point(402, heightPosition);
     LblStatus.Location = new Point(490, heightPosition);
     BtnResetTime.Location = new Point(563, heightPosition);
     CmbSettings.Location = new Point(650, heightPosition - 3);
     BtnSettings.Location = new Point(817, heightPosition);
     BtnSettings.Visible = Config.Singleton.GeneralSettings.UseExpertMode;
     CmbSettings.Visible = Config.Singleton.GeneralSettings.UseExpertMode;
 }