improve:计时器

This commit is contained in:
2025-10-06 14:28:53 +08:00
parent cf800cbd36
commit a31ad5803c
2 changed files with 218 additions and 15 deletions
+113 -15
View File
@@ -8,7 +8,7 @@
Topmost="True" Background="Transparent"
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True"
Loaded="Window_Loaded" Closing="Window_Closing" WindowStartupLocation="CenterScreen"
Title="Ink Canvas 画板 - 计时器" Height="400" Width="600">
Title="Ink Canvas 画板 - 计时器" Height="450" Width="900">
<Border Background="{DynamicResource SeewoTimerWindowBackground}" CornerRadius="15" BorderThickness="1" BorderBrush="{DynamicResource SeewoTimerWindowBorderBrush}" Margin="10">
<Grid>
@@ -16,7 +16,7 @@
<Grid>
<!-- 使用Viewbox自动缩放内容 -->
<Viewbox x:Name="MainViewController" Margin="20,20,20,20">
<Grid Height="350" Width="600">
<Grid Height="400" Width="900">
<!-- 顶部标题栏 -->
<Grid Height="50" Background="{DynamicResource SeewoTimerWindowBackground}" x:Name="TitleBar" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<TextBlock Text="计时" FontSize="20" FontWeight="Bold"
@@ -31,17 +31,20 @@
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Border>
</Grid>
<!-- 6位数字显示区域 -->
<Grid HorizontalAlignment="Center" VerticalAlignment="Center"
x:Name="MainDisplayGrid">
<!-- 6位数字水平排列 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
x:Name="DigitsPanel" Margin="0,-25,0,25">
<!-- 主要内容区域 - 分为左右两部分 -->
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center"
x:Name="MainContentGrid" Margin="0,-25,0,25">
<!-- 左侧:6位数字显示区域 -->
<Grid HorizontalAlignment="Left" VerticalAlignment="Center"
x:Name="MainDisplayGrid" Width="500" Margin="50,0,0,0">
<!-- 6位数字水平排列 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
x:Name="DigitsPanel">
<!-- 小时组(十位和个位) -->
<Grid Margin="0,0,30,0" HorizontalAlignment="Center" Width="120">
<Grid Margin="0,0,40,0" HorizontalAlignment="Center" Width="140">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<!-- 第1位数字(小时十位) -->
<Grid Margin="0,0,15,0">
<Grid Margin="0,0,20,0">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<!-- 上方+按钮 -->
<Button x:Name="Digit1PlusBtn" Width="40" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
@@ -112,10 +115,10 @@
</Grid>
<!-- 分钟组(十位和个位) -->
<Grid Margin="0,0,30,0" HorizontalAlignment="Center" Width="120">
<Grid Margin="0,0,40,0" HorizontalAlignment="Center" Width="140">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<!-- 第3位数字(分钟十位) -->
<Grid Margin="0,0,15,0">
<Grid Margin="0,0,20,0">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<!-- 上方+按钮 -->
<Button x:Name="Digit3PlusBtn" Width="40" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
@@ -186,10 +189,10 @@
</Grid>
<!-- 秒组(十位和个位) -->
<Grid Width="120">
<Grid Width="140">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<!-- 第5位数字(秒十位) -->
<Grid Margin="0,0,15,0">
<Grid Margin="0,0,20,0">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<!-- 上方+按钮 -->
<Button x:Name="Digit5PlusBtn" Width="40" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
@@ -259,7 +262,102 @@
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}" Margin="0,112,0,-12"/>
</Grid>
</StackPanel>
</Grid>
<!-- 右侧:快捷选项区域 -->
<Grid HorizontalAlignment="Right" VerticalAlignment="Center"
x:Name="QuickOptionsGrid" Width="350" Margin="30,0,0,0">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<!-- 第一排:5min, 10min -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,15">
<Button x:Name="Quick5MinBtn" Width="80" Height="50" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
BorderThickness="0" Click="Quick5Min_Click" Cursor="Hand" Margin="0,0,15,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock Text="5分钟" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
<Button x:Name="Quick10MinBtn" Width="80" Height="50" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
BorderThickness="0" Click="Quick10Min_Click" Cursor="Hand">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock Text="10分钟" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
</StackPanel>
<!-- 第二排:15min, 20min -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,15">
<Button x:Name="Quick15MinBtn" Width="80" Height="50" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
BorderThickness="0" Click="Quick15Min_Click" Cursor="Hand" Margin="0,0,15,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock Text="15分钟" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
<Button x:Name="Quick20MinBtn" Width="80" Height="50" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
BorderThickness="0" Click="Quick20Min_Click" Cursor="Hand">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock Text="20分钟" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
</StackPanel>
<!-- 第三排:最近两次计时 -->
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Text="最近计时" FontSize="14" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"
HorizontalAlignment="Center" Margin="0,0,0,10"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="RecentTimer1Btn" Width="80" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
BorderThickness="0" Click="RecentTimer1_Click" Cursor="Hand" Margin="0,0,10,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock x:Name="RecentTimer1Text" Text="--:--" FontSize="14" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
<Button x:Name="RecentTimer2Btn" Width="80" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
BorderThickness="0" Click="RecentTimer2_Click" Cursor="Hand">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock x:Name="RecentTimer2Text" Text="--:--" FontSize="14" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
<!-- 底部控制按钮区域 -->