Skip to content

Commit 9debded

Browse files
committed
微调在Windows10上的云母感亚克力效果
1 parent ff98b40 commit 9debded

File tree

4 files changed

+57
-21
lines changed

4 files changed

+57
-21
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"profiles": {
33
"PreLaunchTaskr.Configurator.NET8": {
4-
"commandName": "Project",
5-
"commandLineArgs": "-dis 10"
4+
"commandName": "Project"
65
}
76
}
87
}

PreLaunchTaskr.GUI.WinUI3/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public partial class App : Application
2323
{
2424
public static string DisplayVersion =>
2525
#if DEBUG
26-
"1.4.0 DEBUG";
26+
"1.4.1 DEBUG";
2727
#else
28-
"1.4.0";
28+
"1.4.1";
2929
#endif
3030

3131
/// <summary>

PreLaunchTaskr.GUI.WinUI3/MainWindow.xaml.cs

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Microsoft.UI;
12
using Microsoft.UI.Composition;
23
using Microsoft.UI.Composition.SystemBackdrops;
34
using Microsoft.UI.Xaml;
@@ -26,41 +27,65 @@ public MainWindow()
2627
ExtendsContentIntoTitleBar = true;
2728
AppWindow.TitleBar.ButtonHoverBackgroundColor = Color.FromArgb(32, 128, 128, 128);
2829
AppWindow.TitleBar.ButtonPressedBackgroundColor = Color.FromArgb(16, 128, 128, 128);
29-
30+
#if DEBUG
31+
if (false)
32+
#else
3033
if (MicaController.IsSupported())
34+
#endif
3135
{
3236
SystemBackdrop = new MicaBackdrop { Kind = MicaKind.BaseAlt };
3337
}
3438
else if (DesktopAcrylicController.IsSupported())
3539
{
36-
systemBackdropConfiguration = new SystemBackdropConfiguration();
37-
desktopAcrylicController = new DesktopAcrylicController
38-
{
39-
Kind = DesktopAcrylicKind.Thin,
40-
LuminosityOpacity = 0.5f
41-
};
42-
desktopAcrylicController.AddSystemBackdropTarget(this.As<ICompositionSupportsSystemBackdrop>());
43-
desktopAcrylicController.SetSystemBackdropConfiguration(systemBackdropConfiguration);
40+
//systemBackdropConfiguration = new SystemBackdropConfiguration();
41+
//desktopAcrylicController = new DesktopAcrylicController
42+
//{
43+
// Kind = DesktopAcrylicKind.Thin,
44+
// LuminosityOpacity = 0.5f
45+
//};
46+
//desktopAcrylicController.AddSystemBackdropTarget(this.As<ICompositionSupportsSystemBackdrop>());
47+
//desktopAcrylicController.SetSystemBackdropConfiguration(systemBackdropConfiguration);
4448
Activated += (o, e) =>
4549
{
46-
systemBackdropConfiguration.IsInputActive = e.WindowActivationState != WindowActivationState.Deactivated;
50+
//systemBackdropConfiguration.IsInputActive = e.WindowActivationState != WindowActivationState.Deactivated;
51+
if (e.WindowActivationState == WindowActivationState.Deactivated)
52+
{
53+
CurrentBackground = InactiveBackground;
54+
}
55+
else
56+
{
57+
CurrentBackground = ActiveBackground;
58+
}
4759
};
60+
SystemBackdrop = new DesktopAcrylicBackdrop();
4861
Color themeColor = new UISettings().GetColorValue(UIColorType.Accent);
49-
themeColor.A = 32;
50-
Background = new SolidColorBrush(themeColor);
62+
themeColor.A = 48;
63+
ActiveBackground = new SolidColorBrush(themeColor);
5164
}
5265
else
5366
{
5467
Color themeColor = new UISettings().GetColorValue(UIColorType.Accent);
55-
themeColor.A = 32;
56-
Background = new SolidColorBrush(themeColor);
68+
themeColor.A = 48;
69+
ActiveBackground = new SolidColorBrush(themeColor);
5770
}
5871

5972
hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
6073
MaterialController = new(this);
6174
}
6275

63-
public Brush Background
76+
public Brush? ActiveBackground
77+
{
78+
get => field;
79+
set => field = value;
80+
}
81+
82+
public Brush? InactiveBackground
83+
{
84+
get => field;
85+
set => field = value;
86+
}
87+
88+
private Brush? CurrentBackground
6489
{
6590
get => ContentFrame.Background;
6691
set => ContentFrame.Background = value;

PreLaunchTaskr.GUI.WinUI3/Views/AboutPage.xaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
<Setter Property="HorizontalAlignment" Value="Stretch" />
1616
<Setter Property="HorizontalContentAlignment" Value="Left" />
1717
</Style>
18+
19+
<Style TargetType="my:IconHyperlinkButton">
20+
<Setter Property="Padding" Value="8" />
21+
</Style>
1822
</Page.Resources>
1923

20-
<ScrollView Margin="36">
24+
<ScrollView Padding="36">
2125
<StackPanel Grid.Row="1" Spacing="16">
2226
<TextBlock Style="{ThemeResource TitleTextBlockStyle}" Text="关于此应用" />
2327

@@ -37,7 +41,6 @@
3741
<my:MyStackPanel>
3842
<my:IconHyperlinkButton
3943
Padding="8"
40-
HorizontalAlignment="Left"
4144
NavigateUri="https://github.com/SuGar0218/PreLaunchTaskr/tree/winui3"
4245
Text="前往 GitHub 查看此项目">
4346
<my:IconHyperlinkButton.IconSource>
@@ -57,6 +60,15 @@
5760
</Expander.Transitions>
5861

5962
<StackPanel>
63+
<my:IconHyperlinkButton
64+
Padding="8"
65+
NavigateUri="https://visualstudio.microsoft.com/zh-hans/vs/preview/"
66+
Text="Visual Studio 2022 Preview">
67+
<my:IconHyperlinkButton.IconSource>
68+
<SymbolIconSource Symbol="Go" />
69+
</my:IconHyperlinkButton.IconSource>
70+
</my:IconHyperlinkButton>
71+
6072
<my:IconHyperlinkButton
6173
Padding="8"
6274
NavigateUri="https://github.com/microsoft/microsoft-ui-xaml"

0 commit comments

Comments
 (0)