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)