public void SetTheme(MsDev2013_Theme themeName) { try { if (themesDefault.ContainsKey(themeName.ResourceID)) ThemeFactory.ChangeTheme(new Uri(themesDefault[themeName.ResourceID], UriKind.RelativeOrAbsolute)); else if (themeName.ResourceID == "dev2010") { ThemeTool.MsDev2010_Theme.Apply_Blue(); ThemeFactory.ChangeTheme(new Uri("/AnotherThemeTool;component/src/assets/dev2010_blue.xaml", UriKind.RelativeOrAbsolute)); } else if (themeName.ResourceID == "dev2o13-dyn") { MsDev2013_Theme.Instance = themeName; ThemeFactory.ChangeTheme(new Uri("/AnotherThemeTool;component/src/assets/dev2o13_dynamic.xaml", UriKind.RelativeOrAbsolute)); } else if (themeName.ResourceID == "dev2o13-blue") { MsDev2013_Theme.Instance = MsDev2013_Theme.Apply(); ThemeFactory.ChangeTheme(new Uri("/AnotherThemeTool;component/src/assets/dev2o13_dynamic.xaml", UriKind.RelativeOrAbsolute)); } else if (themesClassic.Contains(themeName.ResourceID)) ThemeFactory.ChangeTheme(themeName.ResourceID); else if (themeName.ResourceID.StartsWith("#",StringComparison.InvariantCulture)) ThemeFactory.ChangeColors(themeName.ResourceID.ToColor()); else if (themeName.ResourceID == "default") ThemeFactory.ResetTheme(); } catch (Exception ex) { System.Windows.MessageBox.Show("There was some error during applying theme:" + Environment.NewLine + ex, "ThemeTool Error"); } }
public void SaveSettings(MsDev2013_Theme theme) { theme.SaveTheme(SettingsFileName); }
public static void Apply(this string themeId) { var settings = new ThemeTool.Logic.ToolSettings(); var theme = new MsDev2013_Theme{ ResourceID=themeId }; settings.SetTheme(theme); settings.SaveSettings(theme); }
public static MsDev2013_Theme Apply() { // Note that anything I might have foroggen here should show up as '#00000000' (transparent) var theme = new MsDev2013_Theme(); // Color CommonBlue = "4D6082".ToColor(); // Color DarkBlue = "293955".ToColor(); // Color CommonActiveTab = "4D6082".ToColor(); // Color CommonActiveTabFocus = "FFF29D".ToColor(); // Color CommonActiveTabHover = "5B7199".ToColor(); // Color CommonActiveTabBorder = "8E9BBC".ToColor(); theme.Name = "blue-default"; theme.DefaultFontFamily = new FontFamily("Open Sans"); theme.DefaultFontSize = 14; theme.DotsDefault = "00000000".ToColor(); theme.DefaultBackgroundBrush = "293955".ToColor(); theme.LightForegroundBrush = "000000".ToColor(); theme.DarkForegroundBrush = "000000".ToColor(); theme.ManagedContentTabControlNormalBorderBrush = "4D6082".ToColor(); theme.ManagedContentTabItemNormalBackground = "4D6082".ToColor(); theme.ManagedContentTabItemNormalForeground = "4D6082".ToColor(); theme.ManagedContentTabItemInvNormalBackground = "4D6082,4D6082:1".ToStops(); theme.ManagedContentTabItemInvHotBackground = "4D6082,FF00FF:1".ToStops(); theme.ManagedContentTabItemHotBackground = "4D6082,4D6082:1".ToStops(); theme.ManagedContentTabItemSelectedBackground = "FFFFFF".ToColor(); theme.ManagedContentTabItemSelectedForeground = "000000".ToColor(); theme.ManagedContentTabItemDisabledBackground = "4D6082".ToColor(); theme.ManagedContentTabItemDisabledForeground = "4D6082".ToColor(); theme.ManagedContentTabItemSelectedBorderBackround = "FFFFFF".ToColor(); theme.ManagedContentTabItemNormalBorderBrush = "4D6082".ToColor(); theme.ManagedContentTabItemSelectedBorderBrush = "00000000".ToColor(); // Colors.Transparent; theme.ManagedContentTabItemHotBorderBrush = "FFFFFF".ToColor(); theme.ManagedContentTabItemDisabledBorderBrush = "FFFFFF".ToColor(); theme.DockablePaneTitleBackgroundSelected = "4D6082,4D6082:1".ToStops(); theme.DockablePaneTitleBackground = "4D6082,4D6082:1".ToStops(); theme.DockablePaneTitleForeground = "FFFFFF".ToColor(); theme.DockablePaneTitleForegroundSelected = "000000".ToColor(); theme.DocumentHeaderBackground = "4D6082,4D6082:1".ToStops(); theme.DocumentHeaderBorderBrushMouseOver = "00000000".ToColor(); // Colors.Transparent; theme.DocumentHeaderForeground = "FFFFFF".ToColor(); theme.DocumentHeaderForegroundSelected = "FFFFFF".ToColor(); theme.DocumentHeaderForegroundSelectedActivated = "000000".ToColor(); theme.DocumentHeaderBackgroundSelected = "4D6082,4D6082:1".ToStops(); theme.DocumentHeaderBackgroundSelectedActivated = "FFF29D,FFF29D:1".ToStops(); theme.DocumentHeaderBackgroundMouseOver = "5B7199,5B7199:1".ToStops(); theme.PaneHeaderCommandBorderBrush = "4D6082,4D6082:1".ToStops(); theme.PaneHeaderCommandBackground = "FFFFFF".ToColor(); theme.DocumentHeaderBorder = "00FF00".ToColor(); theme.DocumentHeaderBorderSelected = "4D6082".ToColor(); theme.DocumentHeaderBorderSelectedActivated = "FFF29D".ToColor(); theme.OverlayWindowMainBorderBrush = "4D6082".ToColor(); theme.OverlayWindowIntBorderBackground = "4D6082,4D6082:1".ToStops(); theme.OverlayWindowIntBorderBrush = "293955".ToColor(); theme.OverlayWindowIntBorderBrush2 = "4D6082".ToColor(); theme.OverlayWindowIntBorderBackground2 = "4D6082,4D6082:1".ToStops(); return theme; }
public static MsDev2013_Theme ToTheme(this MsDev2013Settings theme) { var tefaut = MsDev2013_Theme.Apply().ToSetting(); var settings = new MsDev2013_Theme(); settings.ResourceID = (theme.ResourceID ?? tefaut.ResourceID); settings.Name = (theme.Name ?? tefaut.Name); settings.DefaultFontSize = double.Parse(theme.DefaultFontSize ?? tefaut.DefaultFontSize); settings.DefaultFontFamily = new FontFamily((theme.DefaultFontFamily ?? tefaut.DefaultFontFamily).ToString()); settings.DotsDefault = (theme.DotsDefault ?? tefaut.DotsDefault ).ToColor(); settings.DefaultBackgroundBrush = (theme.DefaultBackgroundBrush ?? tefaut.DefaultBackgroundBrush ).ToColor(); settings.LightForegroundBrush = (theme.LightForegroundBrush ?? tefaut.LightForegroundBrush ).ToColor(); settings.DarkForegroundBrush = (theme.DarkForegroundBrush ?? tefaut.DarkForegroundBrush ).ToColor(); settings.ManagedContentTabControlNormalBorderBrush = (theme.ManagedContentTabControlNormalBorderBrush ?? tefaut.ManagedContentTabControlNormalBorderBrush ).ToColor(); settings.ManagedContentTabItemNormalBackground = (theme.ManagedContentTabItemNormalBackground ?? tefaut.ManagedContentTabItemNormalBackground ).ToColor(); settings.ManagedContentTabItemNormalForeground = (theme.ManagedContentTabItemNormalForeground ?? tefaut.ManagedContentTabItemNormalForeground ).ToColor(); settings.ManagedContentTabItemNormalBorderBrush = (theme.ManagedContentTabItemNormalBorderBrush ?? tefaut.ManagedContentTabItemNormalBorderBrush ).ToColor(); settings.ManagedContentTabItemInvNormalBackground = (theme.ManagedContentTabItemInvNormalBackground ?? tefaut.ManagedContentTabItemInvNormalBackground ).ToStops(); settings.ManagedContentTabItemInvHotBackground = (theme.ManagedContentTabItemInvHotBackground ?? tefaut.ManagedContentTabItemInvHotBackground ).ToStops(); settings.ManagedContentTabItemHotBackground = (theme.ManagedContentTabItemHotBackground ?? tefaut.ManagedContentTabItemHotBackground ).ToStops(); settings.ManagedContentTabItemHotBorderBrush = (theme.ManagedContentTabItemHotBorderBrush ?? tefaut.ManagedContentTabItemHotBorderBrush ).ToColor(); settings.ManagedContentTabItemSelectedBackground = (theme.ManagedContentTabItemSelectedBackground ?? tefaut.ManagedContentTabItemSelectedBackground ).ToColor(); settings.ManagedContentTabItemSelectedForeground = (theme.ManagedContentTabItemSelectedForeground ?? tefaut.ManagedContentTabItemSelectedForeground ).ToColor(); settings.ManagedContentTabItemSelectedBorderBackround = (theme.ManagedContentTabItemSelectedBorderBackround ?? tefaut.ManagedContentTabItemSelectedBorderBackround ).ToColor(); settings.ManagedContentTabItemSelectedBorderBrush = (theme.ManagedContentTabItemSelectedBorderBrush ?? tefaut.ManagedContentTabItemSelectedBorderBrush ).ToColor(); settings.ManagedContentTabItemDisabledForeground = (theme.ManagedContentTabItemDisabledForeground ?? tefaut.ManagedContentTabItemDisabledForeground ).ToColor(); settings.ManagedContentTabItemDisabledBackground = (theme.ManagedContentTabItemDisabledBackground ?? tefaut.ManagedContentTabItemDisabledBackground ).ToColor(); settings.ManagedContentTabItemDisabledBorderBrush = (theme.ManagedContentTabItemDisabledBorderBrush ?? tefaut.ManagedContentTabItemDisabledBorderBrush ).ToColor(); settings.DockablePaneTitleBackgroundSelected = (theme.DockablePaneTitleBackgroundSelected ?? tefaut.DockablePaneTitleBackgroundSelected ).ToStops(); settings.DockablePaneTitleBackground = (theme.DockablePaneTitleBackground ?? tefaut.DockablePaneTitleBackground ).ToStops(); settings.DockablePaneTitleForeground = (theme.DockablePaneTitleForeground ?? tefaut.DockablePaneTitleForeground ).ToColor(); settings.DockablePaneTitleForegroundSelected = (theme.DockablePaneTitleForegroundSelected ?? tefaut.DockablePaneTitleForegroundSelected ).ToColor(); settings.DocumentHeaderBackground = (theme.DocumentHeaderBackground ?? tefaut.DocumentHeaderBackground ).ToStops(); settings.DocumentHeaderBackgroundSelected = (theme.DocumentHeaderBackgroundSelected ?? tefaut.DocumentHeaderBackgroundSelected ).ToStops(); settings.DocumentHeaderBackgroundSelectedActivated = (theme.DocumentHeaderBackgroundSelectedActivated ?? tefaut.DocumentHeaderBackgroundSelectedActivated ).ToStops(); settings.DocumentHeaderBackgroundMouseOver = (theme.DocumentHeaderBackgroundMouseOver ?? tefaut.DocumentHeaderBackgroundMouseOver ).ToStops(); settings.DocumentHeaderForeground = (theme.DocumentHeaderForeground ?? tefaut.DocumentHeaderForeground ).ToColor(); settings.DocumentHeaderForegroundSelected = (theme.DocumentHeaderForegroundSelected ?? tefaut.DocumentHeaderForegroundSelected ).ToColor(); settings.DocumentHeaderForegroundSelectedActivated = (theme.DocumentHeaderForegroundSelectedActivated ?? tefaut.DocumentHeaderForegroundSelectedActivated ).ToColor(); settings.DocumentHeaderBorder = (theme.DocumentHeaderBorder ?? tefaut.DocumentHeaderBorder ).ToColor(); settings.DocumentHeaderBorderSelected = (theme.DocumentHeaderBorderSelected ?? tefaut.DocumentHeaderBorderSelected ).ToColor(); settings.DocumentHeaderBorderSelectedActivated = (theme.DocumentHeaderBorderSelectedActivated ?? tefaut.DocumentHeaderBorderSelectedActivated ).ToColor(); settings.DocumentHeaderBorderBrushMouseOver = (theme.DocumentHeaderBorderBrushMouseOver ?? tefaut.DocumentHeaderBorderBrushMouseOver ).ToColor(); settings.PaneHeaderCommandBorderBrush = (theme.PaneHeaderCommandBorderBrush ?? tefaut.PaneHeaderCommandBorderBrush ).ToStops(); settings.PaneHeaderCommandBackground = (theme.PaneHeaderCommandBackground ?? tefaut.PaneHeaderCommandBackground ).ToColor(); settings.OverlayWindowMainBorderBrush = (theme.OverlayWindowMainBorderBrush ?? tefaut.OverlayWindowMainBorderBrush ).ToColor(); settings.OverlayWindowIntBorderBackground = (theme.OverlayWindowIntBorderBackground ?? tefaut.OverlayWindowIntBorderBackground ).ToStops(); settings.OverlayWindowIntBorderBrush = (theme.OverlayWindowIntBorderBrush ?? tefaut.OverlayWindowIntBorderBrush ).ToColor(); settings.OverlayWindowIntBorderBrush2 = (theme.OverlayWindowIntBorderBrush2 ?? tefaut.OverlayWindowIntBorderBrush2 ).ToColor(); settings.OverlayWindowIntBorderBackground2 = (theme.OverlayWindowIntBorderBackground2 ?? tefaut.OverlayWindowIntBorderBackground2 ).ToStops(); tefaut = null; return settings; }