Skip to content

Commit

Permalink
Prerelease rc
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Jul 22, 2024
1 parent 9a21fbd commit 9bd3b92
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.6.3-beta.4</Version>
<Version>0.6.3-rc</Version>
</PropertyGroup>
</Project>
15 changes: 15 additions & 0 deletions ricaun.Revit.UI.Tests/Themes/RibbonThemeUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,20 @@ public void ThemeChangedEventArgs_Constructor()
Assert.IsTrue(themeChangedEventArgs.IsLight);
Assert.IsFalse(themeChangedEventArgs.IsDark);
}

[Test]
public void RibbonThemeUtils_LightDark()
{
var isLight = false;
var isDark = false;

RibbonThemeUtils.ThemeChangedTest(
() => { isLight = RibbonThemeUtils.IsLight; },
() => { isDark = RibbonThemeUtils.IsDark; }
);

Assert.IsTrue(isLight);
Assert.IsTrue(isDark);
}
}
}
6 changes: 5 additions & 1 deletion ricaun.Revit.UI/Utils/RibbonThemeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ internal ThemeChangedEventArgs(bool isLight)
/// </remarks>
public class RibbonThemeUtils
{
#pragma warning disable CS0067
/// <summary>
/// ThemeChanged
/// </summary>
public static event ThemeChangedEventHandler ThemeChanged;
#pragma warning restore CS0067
/// <summary>
/// Theme is Light
/// </summary>
Expand All @@ -61,13 +63,15 @@ internal static void Dispose()
ThemeChanged = null;
}

internal static void ThemeChangedTest()
internal static void ThemeChangedTest(Action actionLight = null, Action actionDark = null)
{
UIFramework.RevitRibbonControl.RibbonControl.Dispatcher.Invoke(() =>
{
var color = UIFramework.ApplicationTheme.CurrentTheme.ActiveTabBackgroundColor;
UIFramework.ApplicationTheme.CurrentTheme.ActiveTabBackgroundColor = System.Windows.Media.Colors.White;
actionLight?.Invoke();
UIFramework.ApplicationTheme.CurrentTheme.ActiveTabBackgroundColor = System.Windows.Media.Colors.Black;
actionDark?.Invoke();
UIFramework.ApplicationTheme.CurrentTheme.ActiveTabBackgroundColor = color;
});
}
Expand Down

0 comments on commit 9bd3b92

Please sign in to comment.