From f2ec03c7ec43229dabd930915df709821589e6a8 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 15 Dec 2024 14:41:29 +0800 Subject: [PATCH] Bug fix https://github.com/2dust/v2rayN/issues/6263 --- v2rayN/v2rayN.Desktop/App.axaml.cs | 4 ++-- v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/App.axaml.cs b/v2rayN/v2rayN.Desktop/App.axaml.cs index 898de4e8..82f52a9a 100644 --- a/v2rayN/v2rayN.Desktop/App.axaml.cs +++ b/v2rayN/v2rayN.Desktop/App.axaml.cs @@ -56,13 +56,13 @@ public partial class App : Application { } - private void MenuAddServerViaClipboardClick(object? sender, EventArgs e) + private async void MenuAddServerViaClipboardClick(object? sender, EventArgs e) { if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { if (desktop.MainWindow != null) { - var clipboardData = AvaUtils.GetClipboardData(desktop.MainWindow).Result; + var clipboardData = await AvaUtils.GetClipboardData(desktop.MainWindow); var service = Locator.Current.GetService(); if (service != null) _ = service.AddServerViaClipboardAsync(clipboardData); } diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs index 6f368fe1..185a54d0 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -20,7 +20,7 @@ namespace v2rayN.Views _config.GlobalHotkeys ??= new List(); btnReset.Click += btnReset_Click; - btnSave.Click += btnSave_Click; + btnSave.Click += btnSave_ClickAsync; txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_PreviewKeyDown; txtGlobalHotkey1.KeyDown += TxtGlobalHotkey_PreviewKeyDown; @@ -99,11 +99,11 @@ namespace v2rayN.Views } } - private void btnSave_Click(object sender, RoutedEventArgs e) + private async void btnSave_ClickAsync(object sender, RoutedEventArgs e) { _config.GlobalHotkeys = _TextBoxKeyEventItem.Values.ToList(); - if (ConfigHandler.SaveConfig(_config).Result == 0) + if (await ConfigHandler.SaveConfig(_config) == 0) { HotkeyHandler.Instance.ReLoad(); this.DialogResult = true;