Skip to content

Commit 6c5d007

Browse files
authored
updated to WinAppSDK 1.3.230502000 (#4666)
This PR does 3 things : 1. Update WinUICS project template to 1.3.230502000. 2. Make tests pass by modifying code for StyleCop 3. Adds code which support dynamic changing of titlebar theme whenever system theme changes even when the app is running
1 parent 665590f commit 6c5d007

File tree

8 files changed

+16
-14
lines changed

8 files changed

+16
-14
lines changed

code/TemplateStudio.WinUICs.slnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"solution": {
33
"path": "TemplateStudio.sln",
44
"projects": [
5+
"ProjectTemplates\\WinUICs\\TemplateStudioForWinUICs.ProjectTemplates.csproj",
56
"SharedFunctionality.Core\\SharedFunctionality.Core.shproj",
67
"SharedFunctionality.UI\\SharedFunctionality.UI.shproj",
78
"SharedResources\\SharedResources.csproj",
89
"TemplateStudioForWinUICs\\TemplateStudioForWinUICs.csproj",
9-
"ProjectTemplates\\WinUICs\\TemplateStudioForWinUICs.ProjectTemplates.csproj",
1010
"test\\SharedFunctionality.Core.Tests\\SharedFunctionality.Core.Tests.csproj",
1111
"test\\SharedFunctionality.Tests\\SharedFunctionality.Tests.shproj",
1212
"test\\SharedFunctionality.UI.Tests\\SharedFunctionality.UI.Tests.csproj",

code/TemplateStudioForWinUICpp/Templates/Projects/Default/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"actionId": "0B814718-16A3-4F7F-89F1-69C0F9170EAD",
9292
"args": {
9393
"packageId": "Microsoft.WindowsAppSDK",
94-
"version": "1.3.230331000",
94+
"version": "1.3.230502000",
9595
"projectPath": "Param_ProjectName\\Param_ProjectName.vcxproj"
9696
},
9797
"continueOnError": true

code/TemplateStudioForWinUICs/Templates/Proj/Default/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"actionId": "0B814718-16A3-4F7F-89F1-69C0F9170EAD",
8888
"args": {
8989
"packageId": "Microsoft.WindowsAppSDK",
90-
"version": "1.3.230331000",
90+
"version": "1.3.230502000",
9191
"projectPath": "Param_ProjectName\\Param_ProjectName.csproj"
9292
},
9393
"continueOnError": true

code/TemplateStudioForWinUICs/Templates/Proj/Default/Param_ProjectName/App.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ namespace Param_RootNamespace;
77
public partial class App : Application
88
{
99
public static WindowEx MainWindow { get; } = new MainWindow();
10-
public static UIElement? AppTitlebar;
10+
11+
public static UIElement? AppTitlebar { get; set; }
1112

1213
public App()
1314
{

code/TemplateStudioForWinUICs/Templates/Proj/Default/Param_ProjectName/Helpers/TitleBarHelper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void UpdateTitleBar(ElementTheme theme)
3333

3434
theme = background == Colors.White ? ElementTheme.Light : ElementTheme.Dark;
3535
}
36-
36+
3737
if (theme == ElementTheme.Default)
3838
{
3939
theme = Application.Current.RequestedTheme == ApplicationTheme.Light ? ElementTheme.Light : ElementTheme.Dark;
@@ -116,5 +116,4 @@ public static void ApplySystemThemeToCaptionButtons()
116116
UpdateTitleBar(frame.ActualTheme);
117117
}
118118
}
119-
120119
}

code/TemplateStudioForWinUICs/Templates/Proj/Default/Param_ProjectName/MainWindow.xaml.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ namespace Param_RootNamespace;
44

55
public sealed partial class MainWindow : WindowEx
66
{
7-
public Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue;
8-
private UISettings _settings;
7+
private Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue;
8+
9+
private UISettings settings;
10+
911
public MainWindow()
1012
{
1113
InitializeComponent();
@@ -16,13 +18,13 @@ public MainWindow()
1618

1719
// Theme change code picked from https://github.com/microsoft/WinUI-Gallery/pull/1239
1820
dispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
19-
_settings = new UISettings();
20-
_settings.ColorValuesChanged += _settings_ColorValuesChanged; // cannot use FrameworkElement.ActualThemeChanged event because the triggerTitleBarRepaint workaround no longer works
21+
settings = new UISettings();
22+
settings.ColorValuesChanged += Settings_ColorValuesChanged; // cannot use FrameworkElement.ActualThemeChanged event
2123
}
2224

2325
// this handles updating the caption button colors correctly when indows system theme is changed
2426
// while the app is open
25-
private void _settings_ColorValuesChanged(UISettings sender, object args)
27+
private void Settings_ColorValuesChanged(UISettings sender, object args)
2628
{
2729
// This calls comes off-thread, hence we will need to dispatch it to current app's thread
2830
dispatcherQueue.TryEnqueue(() =>

code/TemplateStudioForWinUICs/Templates/_comp/MT/Project.NavView/Views/ShellPage.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)
4848

4949
AppTitleBarText.Foreground = (SolidColorBrush)App.Current.Resources[resource];
5050
App.AppTitlebar = AppTitleBarText as UIElement;
51-
5251
}
5352

5453
private void NavigationViewControl_DisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)

code/test/SharedFunctionality.Tests/BaseGenAndBuildFixture.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,14 @@ private void CleanUpOldTests()
417417
}
418418
}
419419
}
420-
420+
// Find a better way to get the installed VS root as well as pick one if there are multiple VS instances installed
421+
// issue link : https://github.com/microsoft/TemplateStudio/issues/4667
421422
public static string GetVsInstallRoot()
422423
{
423424
var VsEditions = new List<string> { "Enterprise", "Preview", "Professional", "Community" };
424425

425426
// Try both of these to allow for wonderful inconsistencies in resolving
426-
var progFileLocations = new List<string> { Environment.GetEnvironmentVariable("ProgramW6432"), Environment.GetEnvironmentVariable("ProgramFiles") };
427+
var progFileLocations = new List<string> { Environment.GetEnvironmentVariable("ProgramW6432"), Environment.GetEnvironmentVariable("ProgramFiles"), "D:\\Program Files" };
427428

428429
var basePath = "{0}\\Microsoft Visual Studio\\2022\\{1}\\";
429430

0 commit comments

Comments
 (0)