Skip to content

Commit

Permalink
- Remove confusing usage of PaletteModeManager and PaletteMode
Browse files Browse the repository at this point in the history
- Fix fallout from type removal
- Now a single set of strings for the theme names

##827
  • Loading branch information
Smurf-IV committed Dec 24, 2022
1 parent 8407ac7 commit 295d0b4
Show file tree
Hide file tree
Showing 10 changed files with 682 additions and 2,355 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public static void PropagateThemeSelector(KryptonRibbonGroupDomainUpDown target)
/// Gets the current palette mode.
/// </summary>
/// <param name="manager">The manager.</param>
/// <returns>The current <see cref="PaletteModeManager"/>.</returns>
public static PaletteModeManager GetCurrentPaletteMode(KryptonManager manager) => manager.GlobalPaletteMode;
/// <returns>The current <see cref="PaletteMode"/>.</returns>
public static PaletteMode GetCurrentPaletteMode(KryptonManager manager) => manager.GlobalPaletteMode;

/// <summary>
/// Sets the theme.
Expand All @@ -63,100 +63,28 @@ public static void SetTheme(string themeName, KryptonManager manager)
/// <summary>
/// Returns the palette mode manager as string.
/// </summary>
/// <param name="paletteModeManager">The palette mode manager.</param>
/// <param name="paletteMode">The palette mode manager.</param>
/// <param name="manager">The manager.</param>
/// <returns>The current <see cref="PaletteModeManager"/> as a string.</returns>
public static string ReturnPaletteModeManagerAsString(PaletteModeManager paletteModeManager, KryptonManager manager = null)
{
return ThemeManager.ReturnPaletteModeManagerAsString(paletteModeManager, manager);
}

/// <summary>
/// Returns the palette mode as string.
/// </summary>
/// <param name="paletteMode">The palette mode.</param>
/// <returns>The current <see cref="PaletteMode"/> as a string.</returns>
public static string ReturnPaletteModeAsString(PaletteMode paletteMode)
{
string result = null;

if (paletteMode == PaletteMode.Custom) result = "Custom";

if (paletteMode == PaletteMode.Global) result = "Global";

if (paletteMode == PaletteMode.ProfessionalSystem) result = "Professional - System";

if (paletteMode == PaletteMode.ProfessionalOffice2003) result = "Professional - Office 2003";

if (paletteMode == PaletteMode.Office2007Blue) result = "Office 2007 - Blue";

if (paletteMode == PaletteMode.Office2007Silver) result = "Office 2007 - Silver";

if (paletteMode == PaletteMode.Office2007White) result = "Office 2007 - White";

if (paletteMode == PaletteMode.Office2007Black) result = "Office 2007 - Black";

if (paletteMode == PaletteMode.Office2010Blue) result = "Office 2010 - Blue";

if (paletteMode == PaletteMode.Office2010Silver) result = "Office 2010 - Silver";

if (paletteMode == PaletteMode.Office2010White) result = "Office 2010 - White";

if (paletteMode == PaletteMode.Office2010Black) result = "Office 2010 - Black";

//if (paletteMode == PaletteMode.Office2013) result = "Office 2013";

if (paletteMode == PaletteMode.Office2013White) result = "Office 2013 - White";

if (paletteMode == PaletteMode.SparkleBlue) result = "Sparkle - Blue";

if (paletteMode == PaletteMode.SparkleOrange) result = "Sparkle - Orange";

if (paletteMode == PaletteMode.SparklePurple) result = "Sparkle - Purple";

if (paletteMode == PaletteMode.Microsoft365Blue) result = "Microsoft 365 - Blue";

if (paletteMode == PaletteMode.Microsoft365Silver) result = "Microsoft 365 - Silver";

if (paletteMode == PaletteMode.Microsoft365White) result = "Microsoft 365 - White";

if (paletteMode == PaletteMode.Microsoft365Black) result = "Microsoft 365 - Black";

return result;
}

/// <summary>
/// Applies the global theme.
/// </summary>
/// <param name="manager">The manager.</param>
/// <param name="paletteModeManager">The palette mode manager.</param>
private static void ApplyGlobalTheme(KryptonManager manager, PaletteModeManager paletteModeManager)
public static string ReturnPaletteModeAsString(PaletteMode paletteMode, KryptonManager manager = null)
{
try
{
manager.GlobalPaletteMode = paletteModeManager;
}
catch
{

throw;
}
return ThemeManager.ReturnPaletteModeAsString(paletteMode, manager);
}

/// <summary>
/// Applies the global theme.
/// </summary>
/// <param name="manager">The manager.</param>
/// <param name="mode">The theme mode.</param>
private static void ApplyGlobalTheme(KryptonManager manager, PaletteMode mode)
/// <param name="paletteMode">The palette mode manager.</param>
private static void ApplyGlobalTheme(KryptonManager manager, PaletteMode paletteMode)
{
try
{
manager.GlobalPaletteMode = (PaletteModeManager)mode;
manager.GlobalPaletteMode = paletteMode;
}
catch
{

// TODO: Used DebugUtilities
throw;
}
}
Expand All @@ -177,10 +105,10 @@ public static PaletteMode ApplyThemeMode(string themeName)
/// Applies the theme manager mode.
/// </summary>
/// <param name="themeName">Name of the theme.</param>
/// <returns>The <see cref="PaletteModeManager"/> equivalent.</returns>
public static PaletteModeManager ApplyThemeManagerMode(string themeName)
/// <returns>The <see cref="PaletteMode"/> equivalent.</returns>
public static PaletteMode ApplyThemeManagerMode(string themeName)
{
PaletteModeManager modeManager = (PaletteModeManager)Enum.Parse(typeof(PaletteModeManager), themeName);
PaletteMode modeManager = (PaletteMode)Enum.Parse(typeof(PaletteMode), themeName);

return modeManager;
}
Expand Down
Loading

0 comments on commit 295d0b4

Please sign in to comment.