From 527362dc9fb34b27c27575af15ab1d80df03aa86 Mon Sep 17 00:00:00 2001 From: crazypeace Date: Fri, 30 Jun 2023 13:29:43 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E5=AE=BD=E5=92=8C=E9=AB=98=E7=9A=84=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E5=80=BC,=20=E4=BE=9D=E6=8D=AE=E5=B7=A5=E4=BD=9C=E5=8C=BA?= =?UTF-8?q?=E7=9A=84=E5=AE=BD=E5=92=8C=E9=AB=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决在笔记本屏幕上因为DPI较高导致窗口显示不全的问题. --- v2rayN/v2rayN/Views/AddServer2Window.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 5 +++++ v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/MainWindow.xaml | 2 -- v2rayN/v2rayN/Views/MainWindow.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/SubEditWindow.xaml.cs | 4 ++++ v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs | 4 ++++ 12 files changed, 45 insertions(+), 2 deletions(-) diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs index 5fd56159..71946c9d 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs @@ -11,6 +11,10 @@ namespace v2rayN.Views public AddServer2Window(ProfileItem profileItem) { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; ViewModel = new AddServer2ViewModel(profileItem, this); diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index f16310e2..e75b304d 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -1,4 +1,5 @@ using ReactiveUI; +using System.Net.Security; using System.Reactive.Disposables; using System.Windows; using System.Windows.Controls; @@ -15,6 +16,10 @@ namespace v2rayN.Views public AddServerWindow(ProfileItem profileItem) { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; cmbNetwork.SelectionChanged += CmbNetwork_SelectionChanged; diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index d95bc136..f23e32cb 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -14,6 +14,10 @@ namespace v2rayN.Views public DNSSettingWindow() { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; _config = LazyConfig.Instance.GetConfig(); diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs index 15221b1d..f4c41538 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -16,6 +16,10 @@ namespace v2rayN.Views public GlobalHotkeySettingWindow() { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; _config = LazyConfig.Instance.GetConfig(); _config.globalHotkeys ??= new List(); diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index ba961f66..1e731078 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -15,8 +15,6 @@ Title="v2rayN" Width="900" Height="700" - MinWidth="900" - MinHeight="700" x:TypeArguments="vms:MainWindowViewModel" Background="{DynamicResource MaterialDesignPaper}" FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index d98ab2d5..fad24fd2 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -25,6 +25,10 @@ namespace v2rayN.Views public MainWindow() { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + _config = LazyConfig.Instance.GetConfig(); App.Current.SessionEnding += Current_SessionEnding; diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index 7d44263e..d29d06b7 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -18,6 +18,10 @@ namespace v2rayN.Views public OptionSettingWindow() { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; _config = LazyConfig.Instance.GetConfig(); diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index 45d16c69..400bf64c 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -12,6 +12,10 @@ namespace v2rayN.Views public RoutingRuleDetailsWindow(RulesItem rulesItem) { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; clbProtocol.SelectionChanged += ClbProtocol_SelectionChanged; diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs index cfdb4432..5a0c8d88 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -13,6 +13,10 @@ namespace v2rayN.Views public RoutingRuleSettingWindow(RoutingItem routingItem) { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; this.PreviewKeyDown += RoutingRuleSettingWindow_PreviewKeyDown; diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index 0f001dc9..8d4d712c 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -12,6 +12,10 @@ namespace v2rayN.Views public RoutingSettingWindow() { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; this.Closing += RoutingSettingWindow_Closing; this.PreviewKeyDown += RoutingSettingWindow_PreviewKeyDown; diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs index 00187ce1..4021d176 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -11,6 +11,10 @@ namespace v2rayN.Views public SubEditWindow(SubItem subItem) { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs index 7f4eee58..57d4b86a 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -13,6 +13,10 @@ namespace v2rayN.Views public SubSettingWindow() { InitializeComponent(); + + this.MaxWidth = SystemParameters.WorkArea.Width; + this.MaxHeight = SystemParameters.WorkArea.Height; + this.Owner = Application.Current.MainWindow; ViewModel = new SubSettingViewModel(this); From 0fe7d5e5981bc8eab9a9d71ff0e32b4af832c3ef Mon Sep 17 00:00:00 2001 From: crazypeace Date: Sat, 1 Jul 2023 04:53:42 +0800 Subject: [PATCH 2/9] Update AddServerWindow.xaml.cs --- v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index e75b304d..e91076df 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -1,5 +1,4 @@ using ReactiveUI; -using System.Net.Security; using System.Reactive.Disposables; using System.Windows; using System.Windows.Controls; From f97530a6713fbb5171b0444ee6992efc2913479a Mon Sep 17 00:00:00 2001 From: crazypeace Date: Sun, 2 Jul 2023 12:15:51 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E7=9A=84=E5=B0=BA=E5=AF=B8=E4=B8=8D=E5=A4=A7=E4=BA=8E=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E7=9A=84=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v2rayN/v2rayN/Views/AddServer2Window.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/MainWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/SubEditWindow.xaml.cs | 11 +++++++++-- v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs | 11 +++++++++-- 11 files changed, 99 insertions(+), 22 deletions(-) diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs index 71946c9d..4fd1be1a 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs @@ -12,8 +12,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index e91076df..4db3fa2c 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -16,8 +16,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index f23e32cb..8b84f2a3 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -15,8 +15,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; _config = LazyConfig.Instance.GetConfig(); diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs index f4c41538..5b357f69 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -17,8 +17,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; _config = LazyConfig.Instance.GetConfig(); diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index fad24fd2..9ff4bea0 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -26,8 +26,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } _config = LazyConfig.Instance.GetConfig(); diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index d29d06b7..80f86efe 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -19,8 +19,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; _config = LazyConfig.Instance.GetConfig(); diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index 400bf64c..bd383aeb 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -13,8 +13,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs index 5a0c8d88..a1fc44f6 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -14,8 +14,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index 8d4d712c..e1509d98 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -13,8 +13,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; this.Closing += RoutingSettingWindow_Closing; diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs index 4021d176..521309d8 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -12,8 +12,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; this.Loaded += Window_Loaded; diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs index 57d4b86a..3ebf9e51 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -14,8 +14,15 @@ namespace v2rayN.Views { InitializeComponent(); - this.MaxWidth = SystemParameters.WorkArea.Width; - this.MaxHeight = SystemParameters.WorkArea.Height; + // 设置窗口的尺寸不大于屏幕的尺寸 + if (this.Width > SystemParameters.WorkArea.Width) + { + this.Width = SystemParameters.WorkArea.Width; + } + if (this.Height > SystemParameters.WorkArea.Height) + { + this.Height = SystemParameters.WorkArea.Height; + } this.Owner = Application.Current.MainWindow; From 39504502afe6842cd41e077c14806e6174ecc5f6 Mon Sep 17 00:00:00 2001 From: crazypeace Date: Sun, 2 Jul 2023 12:22:17 +0800 Subject: [PATCH 4/9] Update AddServerWindow.xaml.cs --- v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index 4db3fa2c..bf0dd3d9 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -1,4 +1,5 @@ using ReactiveUI; +using System.Net.Security; using System.Reactive.Disposables; using System.Windows; using System.Windows.Controls; From 62233281efb608715b18d6c4965a0123dd0c5c4d Mon Sep 17 00:00:00 2001 From: crazypeace Date: Sun, 2 Jul 2023 12:40:01 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=B8=8E=E4=B8=8A=E6=B8=B8=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index bf0dd3d9..e83554a9 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -1,5 +1,4 @@ using ReactiveUI; -using System.Net.Security; using System.Reactive.Disposables; using System.Windows; using System.Windows.Controls; @@ -307,4 +306,4 @@ namespace v2rayN.Views this.Close(); } } -} \ No newline at end of file +} From 0821884ff36ec88abeb2865b076434fed873f68a Mon Sep 17 00:00:00 2001 From: crazypeace Date: Sun, 2 Jul 2023 19:45:15 +0800 Subject: [PATCH 6/9] Create dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 115 +++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/dotnet-desktop.yml diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml new file mode 100644 index 00000000..f767f79f --- /dev/null +++ b/.github/workflows/dotnet-desktop.yml @@ -0,0 +1,115 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# This workflow will build, test, sign and package a WPF or Windows Forms desktop application +# built on .NET Core. +# To learn how to migrate your existing application to .NET Core, +# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework +# +# To configure this workflow: +# +# 1. Configure environment variables +# GitHub sets default environment variables for every workflow run. +# Replace the variables relative to your project in the "env" section below. +# +# 2. Signing +# Generate a signing certificate in the Windows Application +# Packaging Project or add an existing signing certificate to the project. +# Next, use PowerShell to encode the .pfx file using Base64 encoding +# by running the following Powershell script to generate the output string: +# +# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte +# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' +# +# Open the output file, SigningCertificate_Encoded.txt, and copy the +# string inside. Then, add the string to the repo as a GitHub secret +# and name it "Base64_Encoded_Pfx." +# For more information on how to configure your signing certificate for +# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing +# +# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". +# See "Build the Windows Application Packaging project" below to see how the secret is used. +# +# For more information on GitHub Actions, refer to https://github.com/features/actions +# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, +# refer to https://github.com/microsoft/github-actions-for-desktop-apps + +name: .NET Core Desktop + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + + strategy: + matrix: + configuration: [Debug, Release] + + runs-on: windows-latest # For a list of available runner types, refer to + # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + + env: + Solution_Name: your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln. + Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. + Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. + Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.2 + + # Execute all unit tests in the solution + - name: Execute unit tests + run: dotnet test + + # Restore the application to populate the obj folder with RuntimeIdentifiers + - name: Restore the application + run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: ${{ matrix.configuration }} + + # Decode the base 64 encoded pfx and save the Signing_Certificate + - name: Decode the pfx + run: | + $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") + $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx + [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) + + # Create the app package by building and packaging the Windows Application Packaging project + - name: Create the app package + run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} + env: + Appx_Bundle: Always + Appx_Bundle_Platforms: x86|x64 + Appx_Package_Build_Mode: StoreUpload + Configuration: ${{ matrix.configuration }} + + # Remove the pfx + - name: Remove the pfx + run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx + + # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: MSIX Package + path: ${{ env.Wap_Project_Directory }}\AppPackages From 46d7128a6e9ac4501dc57de137f02a26e3e6aaf0 Mon Sep 17 00:00:00 2001 From: crazypeace Date: Sun, 2 Jul 2023 19:49:09 +0800 Subject: [PATCH 7/9] Update dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index f767f79f..2ee44c17 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -56,8 +56,8 @@ jobs: # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on env: - Solution_Name: your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln. - Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. + Solution_Name: v2rayN.sln # Replace with your solution name, i.e. MyWpfApp.sln. + Test_Project_Path: v2rayN/v2rayN/v2rayN.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. From ab38fb572d01c18e8f2162a1e0f47cf21003ecd1 Mon Sep 17 00:00:00 2001 From: crazypeace Date: Sun, 2 Jul 2023 19:52:42 +0800 Subject: [PATCH 8/9] Update dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 2ee44c17..8b7a1b9d 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -57,7 +57,7 @@ jobs: env: Solution_Name: v2rayN.sln # Replace with your solution name, i.e. MyWpfApp.sln. - Test_Project_Path: v2rayN/v2rayN/v2rayN.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. + Test_Project_Path: v2rayN/v2rayN.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. From 1914cb3994201d7f7aebb5853755c1e68142f760 Mon Sep 17 00:00:00 2001 From: crazypeace Date: Mon, 3 Jul 2023 01:50:27 +0800 Subject: [PATCH 9/9] Delete dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 115 --------------------------- 1 file changed, 115 deletions(-) delete mode 100644 .github/workflows/dotnet-desktop.yml diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml deleted file mode 100644 index 8b7a1b9d..00000000 --- a/.github/workflows/dotnet-desktop.yml +++ /dev/null @@ -1,115 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow will build, test, sign and package a WPF or Windows Forms desktop application -# built on .NET Core. -# To learn how to migrate your existing application to .NET Core, -# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework -# -# To configure this workflow: -# -# 1. Configure environment variables -# GitHub sets default environment variables for every workflow run. -# Replace the variables relative to your project in the "env" section below. -# -# 2. Signing -# Generate a signing certificate in the Windows Application -# Packaging Project or add an existing signing certificate to the project. -# Next, use PowerShell to encode the .pfx file using Base64 encoding -# by running the following Powershell script to generate the output string: -# -# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte -# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' -# -# Open the output file, SigningCertificate_Encoded.txt, and copy the -# string inside. Then, add the string to the repo as a GitHub secret -# and name it "Base64_Encoded_Pfx." -# For more information on how to configure your signing certificate for -# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing -# -# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". -# See "Build the Windows Application Packaging project" below to see how the secret is used. -# -# For more information on GitHub Actions, refer to https://github.com/features/actions -# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, -# refer to https://github.com/microsoft/github-actions-for-desktop-apps - -name: .NET Core Desktop - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - - build: - - strategy: - matrix: - configuration: [Debug, Release] - - runs-on: windows-latest # For a list of available runner types, refer to - # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on - - env: - Solution_Name: v2rayN.sln # Replace with your solution name, i.e. MyWpfApp.sln. - Test_Project_Path: v2rayN/v2rayN.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. - Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. - Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - # Install the .NET Core workload - - name: Install .NET Core - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild - - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v1.0.2 - - # Execute all unit tests in the solution - - name: Execute unit tests - run: dotnet test - - # Restore the application to populate the obj folder with RuntimeIdentifiers - - name: Restore the application - run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration - env: - Configuration: ${{ matrix.configuration }} - - # Decode the base 64 encoded pfx and save the Signing_Certificate - - name: Decode the pfx - run: | - $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") - $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx - [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) - - # Create the app package by building and packaging the Windows Application Packaging project - - name: Create the app package - run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} - env: - Appx_Bundle: Always - Appx_Bundle_Platforms: x86|x64 - Appx_Package_Build_Mode: StoreUpload - Configuration: ${{ matrix.configuration }} - - # Remove the pfx - - name: Remove the pfx - run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx - - # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact - - name: Upload build artifacts - uses: actions/upload-artifact@v3 - with: - name: MSIX Package - path: ${{ env.Wap_Project_Directory }}\AppPackages