diff --git a/Core/SDKs/HotKey/HotKeyModel.cs b/Core/SDKs/HotKey/HotKeyModel.cs
index 7015d04..9254291 100644
--- a/Core/SDKs/HotKey/HotKeyModel.cs
+++ b/Core/SDKs/HotKey/HotKeyModel.cs
@@ -68,7 +68,7 @@ public bool IsSelectWin
///
/// 选中的按键
///
- public EKey? SelectKey
+ public EKey SelectKey
{
get;
set;
diff --git a/Core/SDKs/Tools/DelayAction.cs b/Core/SDKs/Tools/DelayAction.cs
index 9f2f25d..45cf093 100644
--- a/Core/SDKs/Tools/DelayAction.cs
+++ b/Core/SDKs/Tools/DelayAction.cs
@@ -8,7 +8,7 @@ namespace Core.SDKs.Tools;
public class DelayAction
{
- private readonly string _lock1 = "0";
+ private readonly object _lock1 = new();
private Timer? _timerDbc;
///
diff --git a/uToolkitopia/Converter/HotKeysToHotKeyShow.cs b/uToolkitopia/Converter/HotKeysToHotKeyShow.cs
index b1a56e5..003bac0 100644
--- a/uToolkitopia/Converter/HotKeysToHotKeyShow.cs
+++ b/uToolkitopia/Converter/HotKeysToHotKeyShow.cs
@@ -25,6 +25,11 @@ public object Convert(object? value, Type targetType, object parameter, CultureI
return false;
});
var type = 0000;
+ if (hotKeyModel == null)
+ {
+ return type;
+ }
+
if (hotKeyModel.IsSelectAlt)
{
type += 10;
diff --git a/uToolkitopia/Converter/HotKeysToKeyName.cs b/uToolkitopia/Converter/HotKeysToKeyName.cs
index dc5b889..f2c6243 100644
--- a/uToolkitopia/Converter/HotKeysToKeyName.cs
+++ b/uToolkitopia/Converter/HotKeysToKeyName.cs
@@ -23,6 +23,11 @@ public object Convert(object? value, Type targetType, object parameter, CultureI
return false;
});
+ if (hotKeyModel == null)
+ {
+ return string.Empty;
+ }
+
return hotKeyModel.SelectKey.ToString();
}
diff --git a/uToolkitopia/Services/ToastService.cs b/uToolkitopia/Services/ToastService.cs
index 6c25ee6..4c63682 100644
--- a/uToolkitopia/Services/ToastService.cs
+++ b/uToolkitopia/Services/ToastService.cs
@@ -49,12 +49,12 @@ public void showMessageBox(string Title, string Content, Action? yesAction, Acti
{
case MessageBoxResult.Primary:
{
- yesAction.Invoke();
+ yesAction?.Invoke();
break;
}
case MessageBoxResult.None:
{
- noAction.Invoke();
+ noAction?.Invoke();
break;
}
}
diff --git a/uToolkitopia/View/HotKeyEditorWindow.xaml.cs b/uToolkitopia/View/HotKeyEditorWindow.xaml.cs
index 52352da..dc24610 100644
--- a/uToolkitopia/View/HotKeyEditorWindow.xaml.cs
+++ b/uToolkitopia/View/HotKeyEditorWindow.xaml.cs
@@ -163,7 +163,7 @@ private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
return;
}
- _hotKeyModel.SelectKey = selectedKey;
+ _hotKeyModel.SelectKey = selectedKey.Value;
ConfigManger.Save();
setSuccess = ((MainWindow)ServiceManager.Services.GetService(typeof(MainWindow))).HotKeySet(_hotKeyModel);
if (!setSuccess)