add edit server menu

pull/3165/head
2dust 2 years ago
parent b147e05794
commit fcbc9471aa

@ -1,4 +1,5 @@
using Grpc.Core; using Grpc.Core;
using ProtosLib.Statistics;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using v2rayN.Base; using v2rayN.Base;

@ -681,6 +681,15 @@ namespace v2rayN.Resx {
} }
} }
/// <summary>
/// 查找类似 Edit Server (Ctrl+D) 的本地化字符串。
/// </summary>
public static string menuEditServer {
get {
return ResourceManager.GetString("menuEditServer", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Exit 的本地化字符串。 /// 查找类似 Exit 的本地化字符串。
/// </summary> /// </summary>
@ -1114,7 +1123,7 @@ namespace v2rayN.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 Share Server (Ctrl+D) 的本地化字符串。 /// 查找类似 Share Server (Ctrl+F) 的本地化字符串。
/// </summary> /// </summary>
public static string menuShareServer { public static string menuShareServer {
get { get {

@ -899,7 +899,7 @@
<value>حالت Pac</value> <value>حالت Pac</value>
</data> </data>
<data name="menuShareServer" xml:space="preserve"> <data name="menuShareServer" xml:space="preserve">
<value>اشتراک گذاری سرور(Ctrl+D)</value> <value>اشتراک گذاری سرور(Ctrl+F)</value>
</data> </data>
<data name="menuRouting" xml:space="preserve"> <data name="menuRouting" xml:space="preserve">
<value>مسیریابی</value> <value>مسیریابی</value>

@ -899,7 +899,7 @@
<value>Pac Mode</value> <value>Pac Mode</value>
</data> </data>
<data name="menuShareServer" xml:space="preserve"> <data name="menuShareServer" xml:space="preserve">
<value>Share Server (Ctrl+D)</value> <value>Share Server (Ctrl+F)</value>
</data> </data>
<data name="menuRouting" xml:space="preserve"> <data name="menuRouting" xml:space="preserve">
<value>Routing</value> <value>Routing</value>
@ -1075,4 +1075,7 @@
<data name="SpeedtestingSkip" xml:space="preserve"> <data name="SpeedtestingSkip" xml:space="preserve">
<value>Skip test</value> <value>Skip test</value>
</data> </data>
<data name="menuEditServer" xml:space="preserve">
<value>Edit Server (Ctrl+D)</value>
</data>
</root> </root>

@ -899,7 +899,7 @@
<value>Pac模式</value> <value>Pac模式</value>
</data> </data>
<data name="menuShareServer" xml:space="preserve"> <data name="menuShareServer" xml:space="preserve">
<value>分享服务器 (Ctrl+D)</value> <value>分享服务器 (Ctrl+F)</value>
</data> </data>
<data name="menuRouting" xml:space="preserve"> <data name="menuRouting" xml:space="preserve">
<value>路由</value> <value>路由</value>
@ -1075,4 +1075,7 @@
<data name="SpeedtestingSkip" xml:space="preserve"> <data name="SpeedtestingSkip" xml:space="preserve">
<value>跳过测试</value> <value>跳过测试</value>
</data> </data>
<data name="menuEditServer" xml:space="preserve">
<value>编辑服务器 (Ctrl+D)</value>
</data>
</root> </root>

@ -84,6 +84,7 @@ namespace v2rayN.ViewModels
public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; } public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; }
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; } public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
//servers delete //servers delete
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
public ReactiveCommand<Unit, Unit> RemoveServerCmd { get; } public ReactiveCommand<Unit, Unit> RemoveServerCmd { get; }
public ReactiveCommand<Unit, Unit> RemoveDuplicateServerCmd { get; } public ReactiveCommand<Unit, Unit> RemoveDuplicateServerCmd { get; }
public ReactiveCommand<Unit, Unit> CopyServerCmd { get; } public ReactiveCommand<Unit, Unit> CopyServerCmd { get; }
@ -293,6 +294,10 @@ namespace v2rayN.ViewModels
return ScanScreenTaskAsync(); return ScanScreenTaskAsync();
}); });
//servers delete //servers delete
EditServerCmd = ReactiveCommand.Create(() =>
{
EditServer(false, EConfigType.Custom);
}, canEditRemove);
RemoveServerCmd = ReactiveCommand.Create(() => RemoveServerCmd = ReactiveCommand.Create(() =>
{ {
RemoveServer(); RemoveServer();

@ -433,6 +433,10 @@
</DataGrid.InputBindings> </DataGrid.InputBindings>
<DataGrid.ContextMenu> <DataGrid.ContextMenu>
<ContextMenu Style="{StaticResource DefContextMenu}"> <ContextMenu Style="{StaticResource DefContextMenu}">
<MenuItem
x:Name="menuEditServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuEditServer}" />
<MenuItem <MenuItem
x:Name="menuSetDefaultServer" x:Name="menuSetDefaultServer"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
@ -454,6 +458,31 @@
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuShareServer}" /> Header="{x:Static resx:ResUI.menuShareServer}" />
<Separator /> <Separator />
<MenuItem
x:Name="menuMixedTestServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuMixedTestServer}" />
<MenuItem
x:Name="menuPingServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuPingServer}" />
<MenuItem
x:Name="menuTcpingServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuTcpingServer}" />
<MenuItem
x:Name="menuRealPingServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuRealPingServer}" />
<MenuItem
x:Name="menuSpeedServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSpeedServer}" />
<MenuItem
x:Name="menuSortServerResult"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSortServerResult}" />
<Separator />
<MenuItem <MenuItem
x:Name="menuMoveToGroup" x:Name="menuMoveToGroup"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
@ -493,31 +522,6 @@
Click="menuSelectAll_Click" Click="menuSelectAll_Click"
Header="{x:Static resx:ResUI.menuSelectAll}" /> Header="{x:Static resx:ResUI.menuSelectAll}" />
<Separator /> <Separator />
<MenuItem
x:Name="menuMixedTestServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuMixedTestServer}" />
<MenuItem
x:Name="menuPingServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuPingServer}" />
<MenuItem
x:Name="menuTcpingServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuTcpingServer}" />
<MenuItem
x:Name="menuRealPingServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuRealPingServer}" />
<MenuItem
x:Name="menuSpeedServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSpeedServer}" />
<MenuItem
x:Name="menuSortServerResult"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSortServerResult}" />
<Separator />
<MenuItem <MenuItem
x:Name="menuExport2ClientConfig" x:Name="menuExport2ClientConfig"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"

@ -71,6 +71,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.AddServerViaScanCmd, v => v.menuAddServerViaScan).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.AddServerViaScanCmd, v => v.menuAddServerViaScan).DisposeWith(disposables);
//servers delete //servers delete
this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.menuEditServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RemoveServerCmd, v => v.menuRemoveServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RemoveServerCmd, v => v.menuRemoveServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RemoveDuplicateServerCmd, v => v.menuRemoveDuplicateServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RemoveDuplicateServerCmd, v => v.menuRemoveDuplicateServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CopyServerCmd, v => v.menuCopyServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.CopyServerCmd, v => v.menuCopyServer).DisposeWith(disposables);
@ -323,6 +324,10 @@ namespace v2rayN.Views
ViewModel?.Export2ShareUrl(); ViewModel?.Export2ShareUrl();
} }
else if (e.Key == Key.D) else if (e.Key == Key.D)
{
ViewModel?.EditServer(false, EConfigType.Custom);
}
else if (e.Key == Key.F)
{ {
ViewModel?.ShareServer(); ViewModel?.ShareServer();
} }

Loading…
Cancel
Save