public static void LoadUITheme()
 {
     if (string.IsNullOrEmpty(UserSettings.Instance.get(UserSettingsKey.ActiveThemeName)))
     {
         ActiveTheme.Instance = ActiveTheme.GetThemeColors("Blue - Light");
     }
     else
     {
         string name = UserSettings.Instance.get(UserSettingsKey.ActiveThemeName);
         ActiveTheme.Instance = ActiveTheme.GetThemeColors(name);
     }
 }
Пример #2
0
        public static void SetTheme(string themeName)
        {
            UiThread.RunOnIdle(() =>
            {
                UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, themeName);

                //Set new user selected Default
                ActiveTheme.Instance = ActiveTheme.GetThemeColors(themeName);

                // Explicitly fire ReloadAll in response to user interaction
                ApplicationController.Instance.ReloadAll();
            });
        }
        public Button CreateThemeButton(IThemeColors theme)
        {
            var normal = new GuiWidget(colorSelectSize, colorSelectSize);

            normal.BackgroundColor = theme.PrimaryAccentColor;

            var hover = new GuiWidget(colorSelectSize, colorSelectSize);

            hover.BackgroundColor = theme.SecondaryAccentColor;

            var pressed = new GuiWidget(colorSelectSize, colorSelectSize);

            pressed.BackgroundColor = theme.SecondaryAccentColor;

            var disabled = new GuiWidget(colorSelectSize, colorSelectSize);

            var colorButton = new Button(0, 0, new ButtonViewStates(normal, hover, pressed, disabled))
            {
                Name = theme.Name,
            };

            colorButton.Click += (s, e) =>
            {
                string themeName = ((GuiWidget)s).Name;

                // save it for this printer
                ActiveSliceSettings.Instance.SetValue(SettingsKey.active_theme_name, themeName);

                UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, themeName);
                ActiveTheme.Instance = ActiveTheme.GetThemeColors(themeName);
            };

            colorButton.MouseEnterBounds += (s, e) =>
            {
                colorToChangeTo.BackgroundColor = theme.PrimaryAccentColor;
            };

            colorButton.MouseLeaveBounds += (s, e) =>
            {
                colorToChangeTo.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
            };

            return(colorButton);
        }
Пример #4
0
        static void LoadOemOrDefaultTheme()
        {
            ActiveTheme.SuspendEvents();

            // if not check for the oem color and use it if set
            // else default to "Blue - Light"
            string oemColor = OemSettings.Instance.ThemeColor;

            if (string.IsNullOrEmpty(oemColor))
            {
                ActiveTheme.Instance = ActiveTheme.GetThemeColors("Blue - Light");
            }
            else
            {
                ActiveTheme.Instance = ActiveTheme.GetThemeColors(oemColor);
            }

            ActiveTheme.ResumeEvents();
        }
Пример #5
0
 static void LoadUITheme()
 {
     if (string.IsNullOrEmpty(UserSettings.Instance.get(UserSettingsKey.ActiveThemeName)))
     {
         string oemColor = OemSettings.Instance.ThemeColor;
         if (string.IsNullOrEmpty(oemColor))
         {
             ActiveTheme.Instance = ActiveTheme.GetThemeColors("Blue - Light");
         }
         else
         {
             UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, oemColor);
             ActiveTheme.Instance = ActiveTheme.GetThemeColors(oemColor);
         }
     }
     else
     {
         string name = UserSettings.Instance.get(UserSettingsKey.ActiveThemeName);
         ActiveTheme.Instance = ActiveTheme.GetThemeColors(name);
     }
 }