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>
/// 查找类似 Import Advanced Rules 的本地化字符串。
/// 查找类似 Import Rules 的本地化字符串。
/// </summary>
public static string menuRoutingAdvancedImportRules {
get {

View File

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

View File

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

View File

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

View File

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

View File

@ -32,32 +32,18 @@
<NativeMenuItem
Command="{Binding SystemProxyClearCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyClear}"
IsVisible="{Binding BlNotSystemProxyClear}" />
<NativeMenuItem
Command="{Binding SystemProxyClearCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyClear}"
Icon="/Assets/NotifyIcon1.ico"
IsVisible="{Binding BlSystemProxyClear}" />
IsChecked="{Binding BlSystemProxyClear}"
ToggleType="Radio" />
<NativeMenuItem
Command="{Binding SystemProxySetCmd}"
Header="{x:Static resx:ResUI.menuSystemProxySet}"
IsVisible="{Binding BlNotSystemProxySet}" />
<NativeMenuItem
Command="{Binding SystemProxySetCmd}"
Header="{x:Static resx:ResUI.menuSystemProxySet}"
Icon="/Assets/NotifyIcon2.ico"
IsVisible="{Binding BlSystemProxySet}" />
IsChecked="{Binding BlSystemProxySet}"
ToggleType="Radio" />
<NativeMenuItem
Command="{Binding SystemProxyNothingCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyNothing}"
IsVisible="{Binding BlNotSystemProxyNothing}" />
<NativeMenuItem
Command="{Binding SystemProxyNothingCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyNothing}"
Icon="/Assets/NotifyIcon3.ico"
IsVisible="{Binding BlSystemProxyNothing}" />
IsChecked="{Binding BlSystemProxyNothing}"
ToggleType="Radio" />
<NativeMenuItemSeparator />
<NativeMenuItem Click="MenuAddServerViaClipboardClick" Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" />
<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)
{
var topLevel = TopLevel.GetTopLevel(owner);
if (topLevel == null)
{
return null;
}
var sp = GetStorageProvider(owner);
if (sp is null) return null;
// Start async operation to open the dialog.
var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
var files = await sp.OpenFilePickerAsync(new FilePickerOpenOptions
{
AllowMultiple = false,
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)
{
var topLevel = TopLevel.GetTopLevel(owner);
if (topLevel == null)
{
return null;
}
var sp = GetStorageProvider(owner);
if (sp is null) return null;
// 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();
}
private static IStorageProvider? GetStorageProvider(Window owner)
{
var topLevel = TopLevel.GetTopLevel(owner);
return topLevel?.StorageProvider;
}
}
}

View File

@ -115,7 +115,7 @@
HorizontalAlignment="Left"
Classes="Margin8"
SelectionMode="Multiple"
Theme="{DynamicResource PureCardRadioGroupListBox}" />
Theme="{DynamicResource CardCheckGroupListBox}" />
<TextBlock
Grid.Row="6"
@ -714,7 +714,6 @@
</TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}">
<DockPanel Classes="Margin8">
<Grid
Classes="Margin8"
ColumnDefinitions="Auto,Auto,Auto"
@ -809,7 +808,6 @@
Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPasswordTip}"
TextWrapping="Wrap" />
</Grid>
</DockPanel>
</TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}">

View File

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

View File

@ -997,7 +997,6 @@
</TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}">
<DockPanel Margin="{StaticResource Margin8}">
<Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -1088,7 +1087,6 @@
Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" />
</Grid>
</DockPanel>
</TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}">