Skip to content

Commit f569235

Browse files
committed
修复屏蔽参数正则表达式设置和启动逻辑错误;屏蔽参数列表项新增单独的正则表达式开关切换按钮
1 parent 7583b29 commit f569235

File tree

9 files changed

+135
-17
lines changed

9 files changed

+135
-17
lines changed

PreLaunchTaskr.Core/Services/Launcher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public bool Launch(
132132

133133
// 对原参数剔除后先不加入 StartInfo 启动参数,要在所有参数前附加我们自己的参数,避免造成其他影响。
134134
// 例如:Edge 浏览器,--single-argument 后的参数不会再被空格分成多个参数。
135-
List<string> afterBlock = new(); // 如果没有设置屏蔽参数,则这个列表为空。
135+
List<string> afterBlock = new();
136136
IList<BlockedArgument> blockedArguments = argumentRepository.ListEnabledBlockedArgumentsByProgram(programInfo.Id, true);
137137
foreach (BlockedArgument blockedArgument in blockedArguments)
138138
{
@@ -165,7 +165,7 @@ public bool Launch(
165165
programStartInfo.ArgumentList.Add(attachedArgument.Argument);
166166
}
167167

168-
if (afterBlock.Count == 0)
168+
if (blockedArguments.Count == 0)
169169
{
170170
programStartInfo.ArgumentList.AddAll(originArgs);
171171
}

PreLaunchTaskr.GUI.WinUI3/App.xaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,91 @@
5555
</Setter.Value>
5656
</Setter>
5757
</Style>
58+
59+
<Style
60+
x:Key="MyEllipsisButtonStyle"
61+
BasedOn="{StaticResource EllipsisButton}"
62+
TargetType="Button">
63+
<Setter Property="Width" Value="{x:Null}" />
64+
<Setter Property="Height" Value="36" />
65+
<Setter Property="VerticalAlignment" Value="Center" />
66+
<Setter Property="Template">
67+
<Setter.Value>
68+
<ControlTemplate TargetType="Button">
69+
<Grid Background="Transparent">
70+
<ContentPresenter
71+
x:Name="ContentPresenter"
72+
Padding="{ThemeResource ButtonPadding}"
73+
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
74+
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
75+
AutomationProperties.AccessibilityView="Raw"
76+
Background="{TemplateBinding Background}"
77+
BorderBrush="{TemplateBinding BorderBrush}"
78+
BorderThickness="{TemplateBinding BorderThickness}"
79+
ContentTemplate="{TemplateBinding ContentTemplate}"
80+
ContentTransitions="{TemplateBinding ContentTransitions}"
81+
Control.IsTemplateFocusTarget="True"
82+
CornerRadius="{TemplateBinding CornerRadius}"
83+
Foreground="{TemplateBinding Foreground}" />
84+
85+
<VisualStateManager.VisualStateGroups>
86+
<VisualStateGroup x:Name="CommonStates">
87+
<VisualState x:Name="Normal" />
88+
89+
<VisualState x:Name="PointerOver">
90+
91+
<Storyboard>
92+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
93+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBackgroundPointerOver}" />
94+
</ObjectAnimationUsingKeyFrames>
95+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
96+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundPointerOver}" />
97+
</ObjectAnimationUsingKeyFrames>
98+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
99+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBorderBrushPointerOver}" />
100+
</ObjectAnimationUsingKeyFrames>
101+
</Storyboard>
102+
</VisualState>
103+
104+
<VisualState x:Name="Pressed">
105+
106+
<Storyboard>
107+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
108+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBackgroundPressed}" />
109+
</ObjectAnimationUsingKeyFrames>
110+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
111+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundPressed}" />
112+
</ObjectAnimationUsingKeyFrames>
113+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
114+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBorderBrushPressed}" />
115+
</ObjectAnimationUsingKeyFrames>
116+
</Storyboard>
117+
</VisualState>
118+
119+
<VisualState x:Name="Disabled">
120+
121+
<Storyboard>
122+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
123+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBackgroundDisabled}" />
124+
</ObjectAnimationUsingKeyFrames>
125+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
126+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundDisabled}" />
127+
</ObjectAnimationUsingKeyFrames>
128+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
129+
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBorderBrushDisabled}" />
130+
</ObjectAnimationUsingKeyFrames>
131+
</Storyboard>
132+
</VisualState>
133+
134+
</VisualStateGroup>
135+
136+
</VisualStateManager.VisualStateGroups>
137+
</Grid>
138+
139+
</ControlTemplate>
140+
</Setter.Value>
141+
</Setter>
142+
</Style>
58143
</ResourceDictionary>
59144
</Application.Resources>
60145
</Application>

PreLaunchTaskr.GUI.WinUI3/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace PreLaunchTaskr.GUI.WinUI3;
2222
/// </summary>
2323
public partial class App : Application
2424
{
25-
public static string DisplayVersion = "1.4.8"
25+
public static string DisplayVersion = "1.4.9"
2626
#if DEBUG
2727
+ " DEBUG"
2828
#endif

PreLaunchTaskr.GUI.WinUI3/ViewModels/ItemModels/BlockededArgumentListItem.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
using PreLaunchTaskr.Core.Entities;
1+
using CommunityToolkit.Mvvm.ComponentModel;
2+
3+
using PreLaunchTaskr.Core.Entities;
24
using PreLaunchTaskr.GUI.Common.AbstractViewModels.ItemModels;
35

46
namespace PreLaunchTaskr.GUI.WinUI3.ViewModels.ItemModels;
57

6-
public class BlockedArgumentListItem : IBlockedArgumentListItem
8+
public class BlockedArgumentListItem : ObservableObject, IBlockedArgumentListItem
79
{
810
public BlockedArgumentListItem(BlockedArgument argument)
911
{
@@ -31,19 +33,21 @@ public bool Enabled
3133

3234
argument.Enabled = value;
3335
changed = true;
36+
OnPropertyChanged(nameof(Enabled));
3437
}
3538
}
3639

3740
public bool IsRegex
3841
{
39-
get => argument.Enabled;
42+
get => argument.IsRegex;
4043
set
4144
{
42-
if (argument.Enabled == value)
45+
if (argument.IsRegex == value)
4346
return;
4447

45-
argument.Enabled = value;
48+
argument.IsRegex = value;
4649
changed = true;
50+
OnPropertyChanged(nameof(IsRegex));
4751
}
4852
}
4953

PreLaunchTaskr.GUI.WinUI3/Views/AttachArgumentPage.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@
6767
Text="{x:Bind Argument, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
6868

6969
<StackPanel Grid.Column="2" Orientation="Horizontal">
70-
<Button Background="Transparent" BorderThickness="0">
70+
<Button
71+
Background="Transparent"
72+
BorderThickness="0"
73+
Style="{StaticResource MyEllipsisButtonStyle}">
7174
<SymbolIcon Symbol="More" />
7275
<Button.Flyout>
7376
<MenuFlyout>
@@ -79,7 +82,10 @@
7982
</Button.Flyout>
8083
</Button>
8184

82-
<Button Background="Transparent" BorderThickness="0">
85+
<Button
86+
Background="Transparent"
87+
BorderThickness="0"
88+
Style="{StaticResource MyEllipsisButtonStyle}">
8389
<SymbolIcon Symbol="Delete" />
8490
<Button.Flyout>
8591
<MenuFlyout>

PreLaunchTaskr.GUI.WinUI3/Views/BlockArgumentPage.xaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,15 @@
6666
Text="{x:Bind Argument, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
6767

6868
<StackPanel Grid.Column="2" Orientation="Horizontal">
69-
<Button Background="Transparent" BorderThickness="0">
69+
<ToggleButton
70+
Content="RegEx"
71+
IsChecked="{x:Bind IsRegex, Mode=TwoWay}"
72+
ToolTipService.ToolTip="是否启用正则表达式" />
73+
74+
<Button
75+
Background="Transparent"
76+
BorderThickness="0"
77+
Style="{StaticResource MyEllipsisButtonStyle}">
7078
<SymbolIcon Symbol="More" />
7179
<Button.Flyout>
7280
<MenuFlyout>
@@ -80,7 +88,10 @@
8088
</Button.Flyout>
8189
</Button>
8290

83-
<Button Background="Transparent" BorderThickness="0">
91+
<Button
92+
Background="Transparent"
93+
BorderThickness="0"
94+
Style="{StaticResource MyEllipsisButtonStyle}">
8495
<SymbolIcon Symbol="Delete" />
8596
<Button.Flyout>
8697
<MenuFlyout>

PreLaunchTaskr.GUI.WinUI3/Views/EnvironmentVariablePage.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@
8888
</my:MyStackPanel>
8989

9090
<StackPanel Grid.Column="2" Orientation="Horizontal">
91-
<Button Background="Transparent" BorderThickness="0">
91+
<Button
92+
Background="Transparent"
93+
BorderThickness="0"
94+
Style="{StaticResource MyEllipsisButtonStyle}">
9295
<SymbolIcon Symbol="More" />
9396
<Button.Flyout>
9497
<MenuFlyout>
@@ -104,7 +107,10 @@
104107
</Button.Flyout>
105108
</Button>
106109

107-
<Button Background="Transparent" BorderThickness="0">
110+
<Button
111+
Background="Transparent"
112+
BorderThickness="0"
113+
Style="{StaticResource MyEllipsisButtonStyle}">
108114
<SymbolIcon Symbol="Delete" />
109115
<Button.Flyout>
110116
<MenuFlyout>

PreLaunchTaskr.GUI.WinUI3/Views/PreLaunchTaskPage.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@
6666
Text="{x:Bind Path, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
6767

6868
<StackPanel Grid.Column="2" Orientation="Horizontal">
69-
<Button Background="Transparent" BorderThickness="0">
69+
<Button
70+
Background="Transparent"
71+
BorderThickness="0"
72+
Style="{StaticResource MyEllipsisButtonStyle}">
7073
<SymbolIcon Symbol="More" />
7174
<Button.Flyout>
7275
<MenuFlyout>
@@ -81,7 +84,10 @@
8184
</Button.Flyout>
8285
</Button>
8386

84-
<Button Background="Transparent" BorderThickness="0">
87+
<Button
88+
Background="Transparent"
89+
BorderThickness="0"
90+
Style="{StaticResource MyEllipsisButtonStyle}">
8591
<SymbolIcon Symbol="Delete" />
8692
<Button.Flyout>
8793
<MenuFlyout>

PreLaunchTaskr.Launcher.NET8/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"PreLaunchTaskr.Launcher.NET8": {
44
"commandName": "Project",
5-
"commandLineArgs": "\"D:\\Program Files\\JianyingPro\\JianyingPro.exe\""
5+
"commandLineArgs": "D:\\_temp\\ShowProcessStartInfo.exe\r\n1\r\n2\r\n3\r\nfuck"
66
}
77
}
88
}

0 commit comments

Comments
 (0)