Skip to content

Commit cb3a945

Browse files
committed
补上遗漏文件
1 parent f729dca commit cb3a945

File tree

7 files changed

+219
-0
lines changed

7 files changed

+219
-0
lines changed
1.7 MB
Loading
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using Microsoft.UI.Composition;
2+
using Microsoft.UI.Composition.SystemBackdrops;
3+
using Microsoft.UI.Xaml;
4+
using Microsoft.UI.Xaml.Media;
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Text;
10+
using System.Threading.Tasks;
11+
12+
using Windows.UI;
13+
14+
using WinRT;
15+
16+
namespace PreLaunchTaskr.GUI.WinUI3.Helpers;
17+
18+
/// <summary>
19+
/// 控制 MainWindow 的窗口材质,包括 SystemBackdrop 和背景色。
20+
/// <br/>
21+
/// ActiveBackground 属性是我自己加的,Window 类没有。
22+
/// </summary>
23+
public class MainWindowMaterialController
24+
{
25+
public MainWindowMaterialController(MainWindow window)
26+
{
27+
this.window = window;
28+
}
29+
30+
public void SetBackground(Brush brush)
31+
{
32+
window.ActiveBackground = brush;
33+
}
34+
35+
public void SetBackdrop(SystemBackdrop backdrop)
36+
{
37+
window.SystemBackdrop = backdrop;
38+
}
39+
40+
public void SetCustomBackdrop(ISystemBackdropControllerWithTargets controller, bool fallback)
41+
{
42+
window.Activated -= OnWindowActivated;
43+
systemBackdropConfiguration ??= new();
44+
systemBackdropController?.Dispose();
45+
systemBackdropController = controller;
46+
systemBackdropController.AddSystemBackdropTarget(window.As<ICompositionSupportsSystemBackdrop>());
47+
systemBackdropController.SetSystemBackdropConfiguration(systemBackdropConfiguration);
48+
if (fallback)
49+
{
50+
window.Activated += OnWindowActivated;
51+
}
52+
}
53+
54+
private void OnWindowActivated(object _, WindowActivatedEventArgs args)
55+
{
56+
if (systemBackdropConfiguration is not null)
57+
{
58+
systemBackdropConfiguration.IsInputActive = (args.WindowActivationState != WindowActivationState.Deactivated);
59+
}
60+
}
61+
62+
private readonly MainWindow window;
63+
64+
private ISystemBackdropControllerWithTargets? systemBackdropController;
65+
private SystemBackdropConfiguration? systemBackdropConfiguration;
66+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.UI.Xaml.Media;
2+
3+
using PreLaunchTaskr.GUI.WinUI3.ViewModels.ItemModels;
4+
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace PreLaunchTaskr.GUI.WinUI3.ViewModels.PageModels;
12+
13+
public class SettingsViewModel
14+
{
15+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Page
3+
x:Class="PreLaunchTaskr.GUI.WinUI3.Views.SettingsPage"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="using:PreLaunchTaskr.GUI.WinUI3.Views"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
xmlns:my="using:PreLaunchTaskr.GUI.WinUI3.Controls"
10+
mc:Ignorable="d">
11+
12+
<Page.Resources>
13+
<Style TargetType="Expander">
14+
<Setter Property="HorizontalAlignment" Value="Stretch" />
15+
<Setter Property="HorizontalContentAlignment" Value="Left" />
16+
</Style>
17+
</Page.Resources>
18+
19+
<ScrollView Padding="36">
20+
<Grid RowSpacing="16">
21+
<Grid.RowDefinitions>
22+
<RowDefinition Height="auto" />
23+
<RowDefinition Height="*" />
24+
</Grid.RowDefinitions>
25+
26+
<TextBlock
27+
Grid.Row="0"
28+
Style="{ThemeResource TitleTextBlockStyle}"
29+
Text="设置" />
30+
31+
<StackPanel Grid.Row="1" Spacing="16">
32+
<!--<Expander
33+
HorizontalContentAlignment="Center"
34+
ExpandDirection="Down"
35+
IsExpanded="False">
36+
<Expander.Header>
37+
<my:MyGrid Margin="2,12" ContentVerticalAlignment="Center">
38+
<my:MyGrid.ColumnDefinitions>
39+
<ColumnDefinition Width="auto" />
40+
<ColumnDefinition Width="*" />
41+
<ColumnDefinition Width="auto" />
42+
</my:MyGrid.ColumnDefinitions>
43+
44+
<TextBlock Grid.Column="0" Text="窗口材质" />
45+
46+
<ComboBox Grid.Column="2">
47+
<ComboBoxItem Content="云母" />
48+
<ComboBoxItem Content="云母变体" />
49+
<ComboBoxItem Content="亚克力" />
50+
<ComboBoxItem Content="薄亚克力" />
51+
</ComboBox>
52+
</my:MyGrid>
53+
</Expander.Header>
54+
55+
<StackPanel Spacing="20">
56+
<ColorPicker
57+
ColorSpectrumShape="Ring"
58+
IsAlphaEnabled="True"
59+
IsAlphaSliderVisible="True"
60+
IsAlphaTextInputVisible="False"
61+
IsColorChannelTextInputVisible="False"
62+
IsColorSliderVisible="True"
63+
IsHexInputVisible="False"
64+
IsMoreButtonVisible="False" />
65+
</StackPanel>
66+
</Expander>-->
67+
68+
<!--<Expander ExpandDirection="Down">
69+
<Expander.Header>
70+
<Grid>
71+
<Grid.ColumnDefinitions>
72+
<ColumnDefinition Width="*" />
73+
<ColumnDefinition Width="auto" />
74+
</Grid.ColumnDefinitions>
75+
</Grid>
76+
77+
<TextBlock Grid.Column="0" Text="菜单栏键盘快捷键" />
78+
79+
<ToggleSwitch Grid.Column="1" />
80+
</Expander.Header>
81+
</Expander>-->
82+
</StackPanel>
83+
</Grid>
84+
</ScrollView>
85+
</Page>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.Foundation;
7+
using Windows.Foundation.Collections;
8+
using Microsoft.UI.Xaml;
9+
using Microsoft.UI.Xaml.Controls;
10+
using Microsoft.UI.Xaml.Controls.Primitives;
11+
using Microsoft.UI.Xaml.Data;
12+
using Microsoft.UI.Xaml.Input;
13+
using Microsoft.UI.Xaml.Media;
14+
using Microsoft.UI.Xaml.Navigation;
15+
using PreLaunchTaskr.GUI.WinUI3.ViewModels.PageModels;
16+
17+
namespace PreLaunchTaskr.GUI.WinUI3.Views;
18+
19+
public sealed partial class SettingsPage : Page
20+
{
21+
public SettingsPage()
22+
{
23+
InitializeComponent();
24+
}
25+
26+
//private SettingsViewModel viewModel = new();
27+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
【有什么用】
2+
3+
PreLaunchTaskr 可以设置程序的启动参数、环境变量,在程序启动前执行指定任务。
4+
5+
如果您打开了程序列表中的开关,那么对此程序的配置是几乎*全局生效*的,无论以什么方式启动它。
6+
7+
【现有缺陷】
8+
9+
如果遇到程序无法正常使用,请关闭对它的设置。
10+
11+
原因是我们会在程序所在位置创建一个名称不同的文件,并在启动时采用“映像劫持”的方式,诸如文件名敏感、对目录检测此类的程序可能无法程序使用。

dotnet_publish_all.cmd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@echo off
2+
3+
cd PreLaunchTaskr.Configurator.NET8
4+
dotnet publish -r win-x64 -c release
5+
cd ..
6+
7+
cd PreLaunchTaskr.Launcher.NET8
8+
dotnet publish -r win-x64 -c release
9+
cd ..
10+
11+
cd PreLaunchTaskr.GUI.WinUI3
12+
dotnet publish -r win-x64 -c release
13+
cd ..
14+
15+
pause

0 commit comments

Comments
 (0)