From 79085af99478660c5546ff39001b05d9174b3773 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 30 Aug 2024 12:59:43 +0800 Subject: [PATCH] Bug fix --- v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs | 4 ++-- v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml | 1 + v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs | 5 +++++ v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml | 1 + v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml | 1 + v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml | 1 + v2rayN/v2rayN/Views/MainWindow.xaml.cs | 6 ++++++ 7 files changed, 17 insertions(+), 2 deletions(-) diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index e21fe4c9..bff2d462 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -402,7 +402,7 @@ namespace ServiceLib.ViewModels } if (_config.uiItem.enableAutoAdjustMainLvColWidth) { - Locator.Current.GetService()?.AutofitColumnWidthAsync(); + _updateView?.Invoke(EViewAction.AdjustMainLvColWidth, null); } } } @@ -723,7 +723,7 @@ namespace ServiceLib.ViewModels private void CheckUpdateN() { //Check for standalone windows .Net version - if (Utils.IsWindows() + if (Utils.IsWindows() && File.Exists(Path.Combine(Utils.StartupPath(), "wpfgfx_cor3.dll")) && File.Exists(Path.Combine(Utils.StartupPath(), "D3DCompiler_47_cor3.dll")) ) diff --git a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml index 8e9ada16..196980fc 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml @@ -64,6 +64,7 @@ x:Name="lstConnections" AutoGenerateColumns="False" BorderThickness="1" + CanUserResizeColumns="True" GridLinesVisibility="All" HeadersVisibility="Column" IsReadOnly="True" diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index d30cdb81..a14c92e8 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -279,6 +279,11 @@ namespace v2rayN.Desktop.Views var clipboardData = await AvaUtils.GetClipboardData(this); ViewModel?.AddServerViaClipboardAsync(clipboardData); break; + case EViewAction.AdjustMainLvColWidth: + Dispatcher.UIThread.Post(() => + Locator.Current.GetService()?.AutofitColumnWidthAsync(), + DispatcherPriority.Default); + break; } return await Task.FromResult(true); diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml index 3cc30e57..27a76c06 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml @@ -184,6 +184,7 @@ x:Name="lstRules" AutoGenerateColumns="False" BorderThickness="1" + CanUserResizeColumns="True" GridLinesVisibility="All" HeadersVisibility="Column" IsReadOnly="True" diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml index 699fde4f..40bd0275 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml @@ -87,6 +87,7 @@ x:Name="lstRoutings" AutoGenerateColumns="False" BorderThickness="1" + CanUserResizeColumns="True" GridLinesVisibility="All" HeadersVisibility="Column" IsReadOnly="True" diff --git a/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml index 3606a9db..3d579d5a 100644 --- a/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml @@ -33,6 +33,7 @@ x:Name="lstSubscription" AutoGenerateColumns="False" BorderThickness="1" + CanUserResizeColumns="True" GridLinesVisibility="All" HeadersVisibility="Column" IsReadOnly="True" diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index 74e477fb..745f5222 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -297,6 +297,12 @@ namespace v2rayN.Views var clipboardData = WindowsUtils.GetClipboardData(); ViewModel?.AddServerViaClipboardAsync(clipboardData); break; + case EViewAction.AdjustMainLvColWidth: + Application.Current?.Dispatcher.Invoke((() => + { + Locator.Current.GetService()?.AutofitColumnWidthAsync(); + }), DispatcherPriority.Normal); + break; } return await Task.FromResult(true);