diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs index a02db935..ae03d274 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs @@ -13,16 +13,6 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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; ViewModel = new AddServer2ViewModel(profileItem, this); diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index 1304a758..745572b5 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -16,15 +16,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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 bcacecf3..b7b2a5c7 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -15,16 +15,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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 d05ae013..69090908 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -18,16 +18,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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(); _config.globalHotkeys ??= new List(); diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index 53bdb32d..933c76cc 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -18,15 +18,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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 9c14268e..41b69e69 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -12,15 +12,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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 75028850..b0e0cbe1 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -14,15 +14,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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 0673b090..5575ddd5 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -13,15 +13,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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 5cb7ab70..2baecd87 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -12,15 +12,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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 c6a37dce..5b2d431e 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -14,15 +14,7 @@ namespace v2rayN.Views { InitializeComponent(); - // 设置窗口的尺寸不大于屏幕的尺寸 - 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;