Adjust UI for desktop

pull/6465/head
2dust 2025-01-09 15:14:03 +08:00
parent 8b4a07dfe8
commit e0ae101ff4
10 changed files with 200 additions and 233 deletions

View File

@ -1348,7 +1348,7 @@ namespace ServiceLib.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 Import Advanced Rules 的本地化字符串。 /// 查找类似 Import Rules 的本地化字符串。
/// </summary> /// </summary>
public static string menuRoutingAdvancedImportRules { public static string menuRoutingAdvancedImportRules {
get { get {

View File

@ -842,7 +842,7 @@
<value>Add</value> <value>Add</value>
</data> </data>
<data name="menuRoutingAdvancedImportRules" xml:space="preserve"> <data name="menuRoutingAdvancedImportRules" xml:space="preserve">
<value>Import Advanced Rules</value> <value>Import Rules</value>
</data> </data>
<data name="menuRoutingAdvancedRemove" xml:space="preserve"> <data name="menuRoutingAdvancedRemove" xml:space="preserve">
<value>Remove selected (Delete)</value> <value>Remove selected (Delete)</value>

View File

@ -842,7 +842,7 @@
<value>添加规则集</value> <value>添加规则集</value>
</data> </data>
<data name="menuRoutingAdvancedImportRules" xml:space="preserve"> <data name="menuRoutingAdvancedImportRules" xml:space="preserve">
<value>一键导入高级规则</value> <value>一键导入规则</value>
</data> </data>
<data name="menuRoutingAdvancedRemove" xml:space="preserve"> <data name="menuRoutingAdvancedRemove" xml:space="preserve">
<value>移除所选规则 (Delete)</value> <value>移除所选规则 (Delete)</value>

View File

@ -843,7 +843,7 @@
<value>新增規則集</value> <value>新增規則集</value>
</data> </data>
<data name="menuRoutingAdvancedImportRules" xml:space="preserve"> <data name="menuRoutingAdvancedImportRules" xml:space="preserve">
<value>一鍵匯入進階規則</value> <value>一鍵匯入規則</value>
</data> </data>
<data name="menuRoutingAdvancedRemove" xml:space="preserve"> <data name="menuRoutingAdvancedRemove" xml:space="preserve">
<value>移除所選規則 (Delete)</value> <value>移除所選規則 (Delete)</value>

View File

@ -48,18 +48,6 @@ namespace ServiceLib.ViewModels
[Reactive] [Reactive]
public bool BlSystemProxyPac { get; set; } public bool BlSystemProxyPac { get; set; }
[Reactive]
public bool BlNotSystemProxyClear { get; set; }
[Reactive]
public bool BlNotSystemProxySet { get; set; }
[Reactive]
public bool BlNotSystemProxyNothing { get; set; }
[Reactive]
public bool BlNotSystemProxyPac { get; set; }
public ReactiveCommand<Unit, Unit> SystemProxyClearCmd { get; } public ReactiveCommand<Unit, Unit> SystemProxyClearCmd { get; }
public ReactiveCommand<Unit, Unit> SystemProxySetCmd { get; } public ReactiveCommand<Unit, Unit> SystemProxySetCmd { get; }
public ReactiveCommand<Unit, Unit> SystemProxyNothingCmd { get; } public ReactiveCommand<Unit, Unit> SystemProxyNothingCmd { get; }
@ -333,11 +321,6 @@ namespace ServiceLib.ViewModels
BlSystemProxyNothing = (type == ESysProxyType.Unchanged); BlSystemProxyNothing = (type == ESysProxyType.Unchanged);
BlSystemProxyPac = (type == ESysProxyType.Pac); BlSystemProxyPac = (type == ESysProxyType.Pac);
BlNotSystemProxyClear = !BlSystemProxyClear;
BlNotSystemProxySet = !BlSystemProxySet;
BlNotSystemProxyNothing = !BlSystemProxyNothing;
BlNotSystemProxyPac = !BlSystemProxyPac;
if (blChange) if (blChange)
{ {
_updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null); _updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null);

View File

@ -32,32 +32,18 @@
<NativeMenuItem <NativeMenuItem
Command="{Binding SystemProxyClearCmd}" Command="{Binding SystemProxyClearCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyClear}" Header="{x:Static resx:ResUI.menuSystemProxyClear}"
IsVisible="{Binding BlNotSystemProxyClear}" /> IsChecked="{Binding BlSystemProxyClear}"
<NativeMenuItem ToggleType="Radio" />
Command="{Binding SystemProxyClearCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyClear}"
Icon="/Assets/NotifyIcon1.ico"
IsVisible="{Binding BlSystemProxyClear}" />
<NativeMenuItem <NativeMenuItem
Command="{Binding SystemProxySetCmd}" Command="{Binding SystemProxySetCmd}"
Header="{x:Static resx:ResUI.menuSystemProxySet}" Header="{x:Static resx:ResUI.menuSystemProxySet}"
IsVisible="{Binding BlNotSystemProxySet}" /> IsChecked="{Binding BlSystemProxySet}"
<NativeMenuItem ToggleType="Radio" />
Command="{Binding SystemProxySetCmd}"
Header="{x:Static resx:ResUI.menuSystemProxySet}"
Icon="/Assets/NotifyIcon2.ico"
IsVisible="{Binding BlSystemProxySet}" />
<NativeMenuItem <NativeMenuItem
Command="{Binding SystemProxyNothingCmd}" Command="{Binding SystemProxyNothingCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyNothing}" Header="{x:Static resx:ResUI.menuSystemProxyNothing}"
IsVisible="{Binding BlNotSystemProxyNothing}" /> IsChecked="{Binding BlSystemProxyNothing}"
<NativeMenuItem ToggleType="Radio" />
Command="{Binding SystemProxyNothingCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyNothing}"
Icon="/Assets/NotifyIcon3.ico"
IsVisible="{Binding BlSystemProxyNothing}" />
<NativeMenuItemSeparator /> <NativeMenuItemSeparator />
<NativeMenuItem Click="MenuAddServerViaClipboardClick" Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" /> <NativeMenuItem Click="MenuAddServerViaClipboardClick" Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" />
<NativeMenuItem Header="{x:Static resx:ResUI.menuAddServerViaScan}" IsVisible="False" /> <NativeMenuItem Header="{x:Static resx:ResUI.menuAddServerViaScan}" IsVisible="False" />

View File

@ -17,13 +17,11 @@ namespace v2rayN.Desktop.Common
public static async Task<string?> OpenFileDialog(Window owner, FilePickerFileType? filter) public static async Task<string?> OpenFileDialog(Window owner, FilePickerFileType? filter)
{ {
var topLevel = TopLevel.GetTopLevel(owner); var sp = GetStorageProvider(owner);
if (topLevel == null) if (sp is null) return null;
{
return null;
}
// Start async operation to open the dialog. // Start async operation to open the dialog.
var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions var files = await sp.OpenFilePickerAsync(new FilePickerOpenOptions
{ {
AllowMultiple = false, AllowMultiple = false,
FileTypeFilter = filter is null ? [FilePickerFileTypes.All, FilePickerFileTypes.ImagePng] : [filter] FileTypeFilter = filter is null ? [FilePickerFileTypes.All, FilePickerFileTypes.ImagePng] : [filter]
@ -34,17 +32,21 @@ namespace v2rayN.Desktop.Common
public static async Task<string?> SaveFileDialog(Window owner, string filter) public static async Task<string?> SaveFileDialog(Window owner, string filter)
{ {
var topLevel = TopLevel.GetTopLevel(owner); var sp = GetStorageProvider(owner);
if (topLevel == null) if (sp is null) return null;
{
return null;
}
// Start async operation to open the dialog. // Start async operation to open the dialog.
var files = await topLevel.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions var files = await sp.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
}); });
return files?.TryGetLocalPath(); return files?.TryGetLocalPath();
} }
private static IStorageProvider? GetStorageProvider(Window owner)
{
var topLevel = TopLevel.GetTopLevel(owner);
return topLevel?.StorageProvider;
}
} }
} }

View File

@ -115,7 +115,7 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" Classes="Margin8"
SelectionMode="Multiple" SelectionMode="Multiple"
Theme="{DynamicResource PureCardRadioGroupListBox}" /> Theme="{DynamicResource CardCheckGroupListBox}" />
<TextBlock <TextBlock
Grid.Row="6" Grid.Row="6"
@ -714,102 +714,100 @@
</TabItem> </TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}"> <TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}">
<DockPanel Classes="Margin8"> <Grid
<Grid Classes="Margin8"
ColumnDefinitions="Auto,Auto,Auto"
DockPanel.Dock="Top"
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto">
<TextBlock
Grid.Row="2"
Grid.Column="0"
VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
ColumnDefinitions="Auto,Auto,Auto" Text="Strict Route" />
DockPanel.Dock="Top" <ToggleSwitch
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto"> x:Name="togStrictRoute"
Grid.Row="2"
Grid.Column="1"
HorizontalAlignment="Left"
Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="2" Grid.Row="3"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="Strict Route" /> Text="Stack" />
<ToggleSwitch <ComboBox
x:Name="togStrictRoute" x:Name="cmbStack"
Grid.Row="2" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" Width="200"
Classes="Margin8" /> HorizontalAlignment="Left"
Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="3" Grid.Row="4"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="Stack" /> Text="Mtu" />
<ComboBox <ComboBox
x:Name="cmbStack" x:Name="cmbMtu"
Grid.Row="3" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="5"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="Mtu" /> Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" />
<ComboBox <ToggleSwitch
x:Name="cmbMtu" x:Name="togEnableExInbound"
Grid.Row="4" Grid.Row="5"
Grid.Column="1" Grid.Column="1"
Width="200" HorizontalAlignment="Left"
HorizontalAlignment="Left" Classes="Margin8" />
Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="5" Grid.Row="6"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" /> Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" />
<ToggleSwitch <ToggleSwitch
x:Name="togEnableExInbound" x:Name="togEnableIPv6Address"
Grid.Row="5" Grid.Row="6"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="6" Grid.Row="7"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" /> Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPassword}" />
<ToggleSwitch <TextBox
x:Name="togEnableIPv6Address" x:Name="txtLinuxSudoPassword"
Grid.Row="6" Grid.Row="7"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" Width="200"
Classes="Margin8" /> HorizontalAlignment="Left"
Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="7" Grid.Row="7"
Grid.Column="0" Grid.Column="2"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPassword}" /> Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPasswordTip}"
<TextBox TextWrapping="Wrap" />
x:Name="txtLinuxSudoPassword" </Grid>
Grid.Row="7"
Grid.Column="1"
Width="200"
HorizontalAlignment="Left"
Classes="Margin8" />
<TextBlock
Grid.Row="7"
Grid.Column="2"
VerticalAlignment="Center"
Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPasswordTip}"
TextWrapping="Wrap" />
</Grid>
</DockPanel>
</TabItem> </TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}"> <TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}">

View File

@ -95,7 +95,7 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" Classes="Margin8"
SelectionMode="Multiple" SelectionMode="Multiple"
Theme="{DynamicResource PureCardRadioGroupListBox}" /> Theme="{DynamicResource CardCheckGroupListBox}" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="4"
@ -109,7 +109,7 @@
Grid.Column="1" Grid.Column="1"
Classes="Margin8" Classes="Margin8"
SelectionMode="Multiple" SelectionMode="Multiple"
Theme="{DynamicResource PureCardRadioGroupListBox}" /> Theme="{DynamicResource CardCheckGroupListBox}" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="4"
Grid.Column="2" Grid.Column="2"

View File

@ -997,98 +997,96 @@
</TabItem> </TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}"> <TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}">
<DockPanel Margin="{StaticResource Margin8}"> <Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top">
<Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top"> <Grid.RowDefinitions>
<Grid.RowDefinitions> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> </Grid.RowDefinitions>
</Grid.RowDefinitions> <Grid.ColumnDefinitions>
<Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<TextBlock <TextBlock
Grid.Row="2" Grid.Row="2"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="Strict Route" /> Text="Strict Route" />
<ToggleButton <ToggleButton
x:Name="togStrictRoute" x:Name="togStrictRoute"
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
<TextBlock <TextBlock
Grid.Row="3" Grid.Row="3"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="Stack" /> Text="Stack" />
<ComboBox <ComboBox
x:Name="cmbStack" x:Name="cmbStack"
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="4"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="Mtu" /> Text="Mtu" />
<ComboBox <ComboBox
x:Name="cmbMtu" x:Name="cmbMtu"
Grid.Row="4" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock
Grid.Row="5" Grid.Row="5"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" /> Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" />
<ToggleButton <ToggleButton
x:Name="togEnableExInbound" x:Name="togEnableExInbound"
Grid.Row="5" Grid.Row="5"
Grid.Column="1" Grid.Column="1"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
<TextBlock <TextBlock
Grid.Row="6" Grid.Row="6"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" /> Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" />
<ToggleButton <ToggleButton
x:Name="togEnableIPv6Address" x:Name="togEnableIPv6Address"
Grid.Row="6" Grid.Row="6"
Grid.Column="1" Grid.Column="1"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
</Grid> </Grid>
</DockPanel>
</TabItem> </TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}"> <TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}">