初始版本

This commit is contained in:
ShaoHua
2025-12-31 04:06:10 +08:00
parent 57cfd16e7b
commit 83ad246708
16 changed files with 363 additions and 965 deletions
+3 -2
View File
@@ -7,10 +7,11 @@
xmlns:models="clr-namespace:TodoList.Models"
xmlns:converters="clr-namespace:TodoList.Converters"
mc:Ignorable="d"
Title="待办事项" Height="600" Width="450"
Title="{Binding AppVersion, StringFormat='待办事项 v{0}'}" Height="600" Width="450"
Background="#F5F5F7"
Icon="/icon.ico"
WindowStartupLocation="CenterScreen">
WindowStartupLocation="CenterScreen"
PreviewKeyDown="Window_PreviewKeyDown">
<Window.Resources>
<ObjectDataProvider x:Key="PriorityEnum" MethodName="GetValues"
+19
View File
@@ -19,6 +19,25 @@ namespace TodoList.Views
// Verify if app shuts down? No, ShutdownMode is Explicit.
}
private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
// If settings are open, close settings?
// But user requirement is "Equals pressing X button", which usually means Close/Hide window.
// However, if we want better UX:
if (DataContext is MainViewModel vm && vm.IsSettingsOpen)
{
vm.IsSettingsOpen = false;
e.Handled = true;
return;
}
// Default behavior: Close (Hide) Window
Close();
}
}
private void ShortcutBox_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
e.Handled = true;