mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-21 09:45:48 +08:00
feat(GearTriggerPage): 优化齿轮触发器页面布局并添加删除确认提示
将新增触发器按钮从各标签页内部移至标签头部,根据当前选中标签动态显示对应添加按钮 为触发器删除操作添加带有类型区分提示文本的确认弹窗,防止误删
This commit is contained in:
@@ -20,6 +20,24 @@
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style x:Key="TimedTabActionButtonStyle" TargetType="ui:Button" BasedOn="{StaticResource {x:Type ui:Button}}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SelectedIndex, RelativeSource={RelativeSource AncestorType=TabControl}}" Value="0">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="HotkeyTabActionButtonStyle" TargetType="ui:Button" BasedOn="{StaticResource {x:Type ui:Button}}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SelectedIndex, RelativeSource={RelativeSource AncestorType=TabControl}}" Value="1">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ConsistentTabControlStyle" TargetType="TabControl"
|
||||
BasedOn="{StaticResource {x:Type TabControl}}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
@@ -41,7 +59,30 @@
|
||||
BorderBrush="{DynamicResource SurfaceStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="10">
|
||||
<TabPanel IsItemsHost="True" Background="Transparent" />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TabPanel Grid.Column="0" IsItemsHost="True" Background="Transparent" />
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center"
|
||||
Margin="12,0,0,0">
|
||||
<ui:Button Style="{StaticResource TimedTabActionButtonStyle}"
|
||||
Content="新增定时触发器"
|
||||
Command="{Binding DataContext.AddTimedTriggerCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Icon="{ui:SymbolIcon Add24}"
|
||||
Appearance="Primary" />
|
||||
<ui:Button Style="{StaticResource HotkeyTabActionButtonStyle}"
|
||||
Content="新增快捷键触发器"
|
||||
Command="{Binding DataContext.AddHotkeyTriggerCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Icon="{ui:SymbolIcon Add24}"
|
||||
Appearance="Primary" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1"
|
||||
@@ -469,25 +510,16 @@
|
||||
<TabItem Header="定时触发" Style="{StaticResource ConsistentTabItemStyle}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Margin="16,12,16,0">
|
||||
<ui:Button HorizontalAlignment="Right"
|
||||
Content="新增定时触发器"
|
||||
Command="{Binding AddTimedTriggerCommand}"
|
||||
Icon="{ui:SymbolIcon Add24}"
|
||||
Appearance="Primary" />
|
||||
</Grid>
|
||||
|
||||
<!-- 固定表格头部 -->
|
||||
<ContentPresenter Grid.Row="1"
|
||||
<ContentPresenter Grid.Row="0"
|
||||
ContentTemplate="{StaticResource TimedTableHeaderTemplate}" />
|
||||
|
||||
<!-- 可滚动的列表内容 -->
|
||||
<Grid Grid.Row="2"
|
||||
<Grid Grid.Row="1"
|
||||
Margin="0,6,0,12">
|
||||
<ui:ListView ItemsSource="{Binding TimedTriggers}"
|
||||
ItemContainerStyle="{StaticResource TriggerListViewItemStyle}"
|
||||
@@ -523,25 +555,16 @@
|
||||
<TabItem Header="快捷键触发" Style="{StaticResource ConsistentTabItemStyle}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Margin="16,12,16,0">
|
||||
<ui:Button HorizontalAlignment="Right"
|
||||
Content="新增快捷键触发器"
|
||||
Command="{Binding AddHotkeyTriggerCommand}"
|
||||
Icon="{ui:SymbolIcon Add24}"
|
||||
Appearance="Primary" />
|
||||
</Grid>
|
||||
|
||||
<!-- 固定表格头部 -->
|
||||
<ContentPresenter Grid.Row="1"
|
||||
<ContentPresenter Grid.Row="0"
|
||||
ContentTemplate="{StaticResource TableHeaderTemplate}" />
|
||||
|
||||
<!-- 可滚动的列表内容 -->
|
||||
<Grid Grid.Row="2"
|
||||
<Grid Grid.Row="1"
|
||||
Margin="0,6,0,12">
|
||||
<ui:ListView ItemsSource="{Binding HotkeyTriggers}"
|
||||
ItemContainerStyle="{StaticResource TriggerListViewItemStyle}"
|
||||
|
||||
@@ -198,6 +198,17 @@ public partial class GearTriggerPageViewModel : ViewModel
|
||||
return;
|
||||
}
|
||||
|
||||
var triggerTypeName = trigger.TriggerType == TriggerType.Timed ? "定时触发器" : "快捷键触发器";
|
||||
var result = await ThemedMessageBox.ShowAsync(
|
||||
$"确定要删除{triggerTypeName}「{trigger.Name}」吗?",
|
||||
"确认删除",
|
||||
System.Windows.MessageBoxButton.YesNo,
|
||||
ThemedMessageBox.MessageBoxIcon.Question);
|
||||
if (result != System.Windows.MessageBoxResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (trigger.TriggerType)
|
||||
{
|
||||
case TriggerType.Timed:
|
||||
|
||||
Reference in New Issue
Block a user