From d12297909c18ed1906c5ff3fb6c02e66d54b4c41 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 8 Nov 2024 11:04:03 +0800 Subject: [PATCH] Improve the code for WPF Global Window --- v2rayN/v2rayN/App.xaml | 11 ++++++++++- v2rayN/v2rayN/Views/AddServer2Window.xaml | 6 ------ v2rayN/v2rayN/Views/AddServerWindow.xaml | 5 ----- v2rayN/v2rayN/Views/ClashConnectionsView.xaml | 6 +++--- v2rayN/v2rayN/Views/ClashProxiesView.xaml | 8 ++++---- v2rayN/v2rayN/Views/DNSSettingWindow.xaml | 6 ------ v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml | 6 ------ v2rayN/v2rayN/Views/MainWindow.xaml | 5 ----- v2rayN/v2rayN/Views/OptionSettingWindow.xaml | 6 ------ v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml | 12 +++--------- v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml | 12 +++--------- v2rayN/v2rayN/Views/RoutingSettingWindow.xaml | 6 ------ v2rayN/v2rayN/Views/SubEditWindow.xaml | 7 ------- v2rayN/v2rayN/Views/SubSettingWindow.xaml | 6 ------ 14 files changed, 23 insertions(+), 79 deletions(-) diff --git a/v2rayN/v2rayN/App.xaml b/v2rayN/v2rayN/App.xaml index 5327b705..b22ea83b 100644 --- a/v2rayN/v2rayN/App.xaml +++ b/v2rayN/v2rayN/App.xaml @@ -1,9 +1,9 @@  @@ -211,6 +211,11 @@ + + + + + diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml b/v2rayN/v2rayN/Views/AddServer2Window.xaml index 5c12a951..36b0c9cc 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml @@ -2,7 +2,6 @@ x:Class="v2rayN.Views.AddServer2Window" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:conv="clr-namespace:v2rayN.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -13,13 +12,8 @@ Width="700" Height="500" x:TypeArguments="vms:AddServer2ViewModel" - Background="{DynamicResource MaterialDesignPaper}" - FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - ResizeMode="NoResize" ShowInTaskbar="False" Style="{StaticResource WindowGlobal}" - TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - TextElement.Foreground="{DynamicResource MaterialDesignBody}" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml b/v2rayN/v2rayN/Views/AddServerWindow.xaml index 760650ea..bbec6703 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml @@ -2,7 +2,6 @@ x:Class="v2rayN.Views.AddServerWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:conv="clr-namespace:v2rayN.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -13,13 +12,9 @@ Width="900" Height="700" x:TypeArguments="vms:AddServerViewModel" - Background="{DynamicResource MaterialDesignPaper}" - FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" ResizeMode="CanResize" ShowInTaskbar="False" Style="{StaticResource WindowGlobal}" - TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - TextElement.Foreground="{DynamicResource MaterialDesignBody}" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> diff --git a/v2rayN/v2rayN/Views/ClashConnectionsView.xaml b/v2rayN/v2rayN/Views/ClashConnectionsView.xaml index 8ea9ca0b..e5781abe 100644 --- a/v2rayN/v2rayN/Views/ClashConnectionsView.xaml +++ b/v2rayN/v2rayN/Views/ClashConnectionsView.xaml @@ -1,11 +1,11 @@ diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml index 08669761..629bc6ae 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml @@ -2,7 +2,6 @@ x:Class="v2rayN.Views.GlobalHotkeySettingWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:conv="clr-namespace:v2rayN.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -13,14 +12,9 @@ Width="700" Height="500" x:TypeArguments="vms:SubEditViewModel" - Background="{DynamicResource MaterialDesignPaper}" - FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" KeyDown="GlobalHotkeySettingWindow_KeyDown" - ResizeMode="NoResize" ShowInTaskbar="False" Style="{StaticResource WindowGlobal}" - TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - TextElement.Foreground="{DynamicResource MaterialDesignBody}" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index 79d2ffbe..14ae889a 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -2,7 +2,6 @@ x:Class="v2rayN.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:conv="clr-namespace:v2rayN.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -15,12 +14,8 @@ Height="700" MinWidth="900" x:TypeArguments="vms:MainWindowViewModel" - Background="{DynamicResource MaterialDesignPaper}" - FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" ShowInTaskbar="True" Style="{StaticResource WindowGlobal}" - TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - TextElement.Foreground="{DynamicResource MaterialDesignBody}" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index 61ce6d2c..2303d8f6 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -2,7 +2,6 @@ x:Class="v2rayN.Views.OptionSettingWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:conv="clr-namespace:v2rayN.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -13,13 +12,8 @@ Width="1000" Height="700" x:TypeArguments="vms:OptionSettingViewModel" - Background="{DynamicResource MaterialDesignPaper}" - FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - ResizeMode="NoResize" ShowInTaskbar="False" Style="{StaticResource WindowGlobal}" - TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - TextElement.Foreground="{DynamicResource MaterialDesignBody}" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml index f3c86a74..758b203c 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml @@ -1,25 +1,19 @@  diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml index 581bb805..08bef17c 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml @@ -1,25 +1,19 @@  diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml index a140a4f8..70621361 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml @@ -2,7 +2,6 @@ x:Class="v2rayN.Views.RoutingSettingWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:conv="clr-namespace:v2rayN.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -13,13 +12,8 @@ Width="990" Height="700" x:TypeArguments="vms:RoutingSettingViewModel" - Background="{DynamicResource MaterialDesignPaper}" - FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - ResizeMode="NoResize" ShowInTaskbar="False" Style="{StaticResource WindowGlobal}" - TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - TextElement.Foreground="{DynamicResource MaterialDesignBody}" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml b/v2rayN/v2rayN/Views/SubEditWindow.xaml index 3853afd8..6f39e9c1 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml @@ -2,7 +2,6 @@ x:Class="v2rayN.Views.SubEditWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:conv="clr-namespace:v2rayN.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -13,13 +12,8 @@ Width="700" Height="600" x:TypeArguments="vms:SubEditViewModel" - Background="{DynamicResource MaterialDesignPaper}" - FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - ResizeMode="NoResize" ShowInTaskbar="False" Style="{StaticResource WindowGlobal}" - TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" - TextElement.Foreground="{DynamicResource MaterialDesignBody}" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> @@ -302,7 +296,6 @@ Style="{StaticResource MyOutlinedTextBox}" ToolTip="{x:Static resx:ResUI.TipPreSocksPort}" /> -