From 994b00c2b772d1f6398b82592445f10a0588c079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=9D=E9=9B=B6?= <78294929+JiuLing-zhang@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:01:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=A8=8B=E5=BA=8F=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E9=94=81=E5=AE=9A=E5=B1=8F=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppSettings.cs | 5 +++++ src/Pages/Index.razor | 5 +++++ src/Resources/Lang.Designer.cs | 9 +++++++++ src/Resources/Lang.en.resx | 3 +++ src/Resources/Lang.resx | 3 +++ src/Resources/Lang.zh.resx | 3 +++ src/WindowMain.xaml | 2 +- src/WindowMain.xaml.cs | 5 +++++ 8 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/AppSettings.cs b/src/AppSettings.cs index ec61206..9e9f546 100644 --- a/src/AppSettings.cs +++ b/src/AppSettings.cs @@ -25,6 +25,11 @@ public class AppSettings /// public bool LockAnimation { get; set; } = true; + /// + /// 程序启动时锁定 + /// + public bool LockOnStartup { get; set; } = false; + /// /// 自动锁定的秒数 /// diff --git a/src/Pages/Index.razor b/src/Pages/Index.razor index fa4e0b5..0d27f25 100644 --- a/src/Pages/Index.razor +++ b/src/Pages/Index.razor @@ -56,6 +56,11 @@ Label="@(Lang["MouseDownActivePwd"])" Color="Color.Primary" /> + +
@(Lang["LockShortcutKey"]) + /// 查找类似 的本地化字符串。 + /// + public static string LockOnStartup { + get { + return ResourceManager.GetString("LockOnStartup", resourceCulture); + } + } + /// /// 查找类似 的本地化字符串。 /// diff --git a/src/Resources/Lang.en.resx b/src/Resources/Lang.en.resx index 33829fb..6c19d22 100644 --- a/src/Resources/Lang.en.resx +++ b/src/Resources/Lang.en.resx @@ -306,4 +306,7 @@ Are you sure you want to reset all settings? + + Lock screen on startup + \ No newline at end of file diff --git a/src/Resources/Lang.resx b/src/Resources/Lang.resx index 4714ef7..37fc1d7 100644 --- a/src/Resources/Lang.resx +++ b/src/Resources/Lang.resx @@ -286,4 +286,7 @@ + + + \ No newline at end of file diff --git a/src/Resources/Lang.zh.resx b/src/Resources/Lang.zh.resx index 50cf3ad..d691cae 100644 --- a/src/Resources/Lang.zh.resx +++ b/src/Resources/Lang.zh.resx @@ -303,4 +303,7 @@ 确定要重置所有设置并重启程序吗? + + 程序启动时锁定屏幕 + \ No newline at end of file diff --git a/src/WindowMain.xaml b/src/WindowMain.xaml index c1ce095..0e6ce46 100644 --- a/src/WindowMain.xaml +++ b/src/WindowMain.xaml @@ -8,7 +8,7 @@ xmlns:ui="http://schemas.modernwpf.com/2019" mc:Ignorable="d" Title="透明锁屏" - Height="450" + Height="490" Width="530" ResizeMode="NoResize" WindowState="Normal" diff --git a/src/WindowMain.xaml.cs b/src/WindowMain.xaml.cs index 5f0162c..3578283 100644 --- a/src/WindowMain.xaml.cs +++ b/src/WindowMain.xaml.cs @@ -68,6 +68,11 @@ public WindowMain(KeyboardHook keyboardHook, AppSettings appSettings, ILocker lo }; } + if (_appSettings.LockOnStartup) + { + _logger.Write("程序启动时锁定屏幕"); + _locker.Lock(); + } } private void Window_Loaded(object sender, RoutedEventArgs e)