mirror of
https://github.com/2dust/v2rayN.git
synced 2025-05-06 15:18:53 +00:00
parent
bdae08b13b
commit
2698137dea
4 changed files with 97 additions and 90 deletions
|
@ -414,7 +414,7 @@ namespace ServiceLib.ViewModels
|
||||||
var ret = await _updateView?.Invoke(EViewAction.OptionSettingWindow, null);
|
var ret = await _updateView?.Invoke(EViewAction.OptionSettingWindow, null);
|
||||||
if (ret == true)
|
if (ret == true)
|
||||||
{
|
{
|
||||||
Locator.Current.GetService<StatusBarViewModel>()?.InboundDisplayStaus();
|
Locator.Current.GetService<StatusBarViewModel>()?.InboundDisplayStatus();
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,12 +106,10 @@ namespace ServiceLib.ViewModels
|
||||||
public StatusBarViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
public StatusBarViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||||
{
|
{
|
||||||
_config = AppHandler.Instance.Config;
|
_config = AppHandler.Instance.Config;
|
||||||
_updateView = updateView;
|
|
||||||
|
|
||||||
if (_updateView != null)
|
if (updateView != null)
|
||||||
{
|
{
|
||||||
MessageBus.Current.Listen<string>(EMsgCommand.RefreshProfiles.ToString())
|
Init(updateView);
|
||||||
.Subscribe(async x => await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectedRouting = new();
|
SelectedRouting = new();
|
||||||
|
@ -127,7 +125,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshRoutingsMenu();
|
RefreshRoutingsMenu();
|
||||||
InboundDisplayStaus();
|
InboundDisplayStatus();
|
||||||
ChangeSystemProxyAsync(_config.systemProxyItem.sysProxyType, true);
|
ChangeSystemProxyAsync(_config.systemProxyItem.sysProxyType, true);
|
||||||
|
|
||||||
#region WhenAnyValue && ReactiveCommand
|
#region WhenAnyValue && ReactiveCommand
|
||||||
|
@ -426,19 +424,12 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
#region UI
|
#region UI
|
||||||
|
|
||||||
public void InboundDisplayStaus()
|
public void InboundDisplayStatus()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
sb.Append($"[{EInboundProtocol.socks}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}]");
|
sb.Append($"[{EInboundProtocol.socks}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}]");
|
||||||
sb.Append(" | ");
|
sb.Append(" | ");
|
||||||
//if (_config.systemProxyItem.sysProxyType == ESysProxyType.ForcedChange)
|
|
||||||
//{
|
|
||||||
// sb.Append($"[{Global.InboundHttp}({ResUI.SystemProxy}):{LazyConfig.Instance.GetLocalPort(Global.InboundHttp)}]");
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
sb.Append($"[{EInboundProtocol.http}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.http)}]");
|
sb.Append($"[{EInboundProtocol.http}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.http)}]");
|
||||||
//}
|
|
||||||
InboundDisplay = $"{ResUI.LabLocal}:{sb}";
|
InboundDisplay = $"{ResUI.LabLocal}:{sb}";
|
||||||
|
|
||||||
if (_config.inbound[0].allowLANConn)
|
if (_config.inbound[0].allowLANConn)
|
||||||
|
|
|
@ -80,26 +80,31 @@ namespace v2rayN.Desktop.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
|
||||||
|
|
||||||
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
|
switch (_config.uiItem.mainGirdOrientation)
|
||||||
{
|
{
|
||||||
|
case EGirdOrientation.Horizontal:
|
||||||
gridMain.IsVisible = true;
|
gridMain.IsVisible = true;
|
||||||
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabMsgView.IsVisible).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies.IsVisible).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies.IsVisible).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections.IsVisible).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections.IsVisible).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain.SelectedIndex).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain.SelectedIndex).DisposeWith(disposables);
|
||||||
}
|
break;
|
||||||
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
|
|
||||||
{
|
case EGirdOrientation.Vertical:
|
||||||
gridMain1.IsVisible = true;
|
gridMain1.IsVisible = true;
|
||||||
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabMsgView1.IsVisible).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies1.IsVisible).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies1.IsVisible).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections1.IsVisible).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections1.IsVisible).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain1.SelectedIndex).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain1.SelectedIndex).DisposeWith(disposables);
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
case EGirdOrientation.Tab:
|
||||||
|
default:
|
||||||
gridMain2.IsVisible = true;
|
gridMain2.IsVisible = true;
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies2.IsVisible).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies2.IsVisible).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections2.IsVisible).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections2.IsVisible).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain2.SelectedIndex).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain2.SelectedIndex).DisposeWith(disposables);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -115,26 +120,29 @@ namespace v2rayN.Desktop.Views
|
||||||
menuGlobalHotkeySetting.IsVisible = false;
|
menuGlobalHotkeySetting.IsVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
|
switch (_config.uiItem.mainGirdOrientation)
|
||||||
{
|
{
|
||||||
|
case EGirdOrientation.Horizontal:
|
||||||
tabProfiles.Content ??= new ProfilesView(this);
|
tabProfiles.Content ??= new ProfilesView(this);
|
||||||
tabMsgView.Content ??= new MsgView();
|
tabMsgView.Content ??= new MsgView();
|
||||||
tabClashProxies.Content ??= new ClashProxiesView();
|
tabClashProxies.Content ??= new ClashProxiesView();
|
||||||
tabClashConnections.Content ??= new ClashConnectionsView();
|
tabClashConnections.Content ??= new ClashConnectionsView();
|
||||||
}
|
break;
|
||||||
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
|
|
||||||
{
|
case EGirdOrientation.Vertical:
|
||||||
tabProfiles1.Content ??= new ProfilesView(this);
|
tabProfiles1.Content ??= new ProfilesView(this);
|
||||||
tabMsgView1.Content ??= new MsgView();
|
tabMsgView1.Content ??= new MsgView();
|
||||||
tabClashProxies1.Content ??= new ClashProxiesView();
|
tabClashProxies1.Content ??= new ClashProxiesView();
|
||||||
tabClashConnections1.Content ??= new ClashConnectionsView();
|
tabClashConnections1.Content ??= new ClashConnectionsView();
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
case EGirdOrientation.Tab:
|
||||||
|
default:
|
||||||
tabProfiles2.Content ??= new ProfilesView(this);
|
tabProfiles2.Content ??= new ProfilesView(this);
|
||||||
tabMsgView2.Content ??= new MsgView();
|
tabMsgView2.Content ??= new MsgView();
|
||||||
tabClashProxies2.Content ??= new ClashProxiesView();
|
tabClashProxies2.Content ??= new ClashProxiesView();
|
||||||
tabClashConnections2.Content ??= new ClashConnectionsView();
|
tabClashConnections2.Content ??= new ClashConnectionsView();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
conTheme.Content ??= new ThemeSettingView();
|
conTheme.Content ??= new ThemeSettingView();
|
||||||
|
|
||||||
|
|
|
@ -41,26 +41,29 @@ namespace v2rayN.Views
|
||||||
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel));
|
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel));
|
||||||
|
|
||||||
WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
|
WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
|
||||||
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
|
switch (_config.uiItem.mainGirdOrientation)
|
||||||
{
|
{
|
||||||
|
case EGirdOrientation.Horizontal:
|
||||||
tabProfiles.Content ??= new ProfilesView();
|
tabProfiles.Content ??= new ProfilesView();
|
||||||
tabMsgView.Content ??= new MsgView();
|
tabMsgView.Content ??= new MsgView();
|
||||||
tabClashProxies.Content ??= new ClashProxiesView();
|
tabClashProxies.Content ??= new ClashProxiesView();
|
||||||
tabClashConnections.Content ??= new ClashConnectionsView();
|
tabClashConnections.Content ??= new ClashConnectionsView();
|
||||||
}
|
break;
|
||||||
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
|
|
||||||
{
|
case EGirdOrientation.Vertical:
|
||||||
tabProfiles1.Content ??= new ProfilesView();
|
tabProfiles1.Content ??= new ProfilesView();
|
||||||
tabMsgView1.Content ??= new MsgView();
|
tabMsgView1.Content ??= new MsgView();
|
||||||
tabClashProxies1.Content ??= new ClashProxiesView();
|
tabClashProxies1.Content ??= new ClashProxiesView();
|
||||||
tabClashConnections1.Content ??= new ClashConnectionsView();
|
tabClashConnections1.Content ??= new ClashConnectionsView();
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
case EGirdOrientation.Tab:
|
||||||
|
default:
|
||||||
tabProfiles2.Content ??= new ProfilesView();
|
tabProfiles2.Content ??= new ProfilesView();
|
||||||
tabMsgView2.Content ??= new MsgView();
|
tabMsgView2.Content ??= new MsgView();
|
||||||
tabClashProxies2.Content ??= new ClashProxiesView();
|
tabClashProxies2.Content ??= new ClashProxiesView();
|
||||||
tabClashConnections2.Content ??= new ClashConnectionsView();
|
tabClashConnections2.Content ??= new ClashConnectionsView();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
pbTheme.Content ??= new ThemeSettingView();
|
pbTheme.Content ??= new ThemeSettingView();
|
||||||
|
|
||||||
|
@ -99,26 +102,31 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
|
||||||
|
|
||||||
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
|
switch (_config.uiItem.mainGirdOrientation)
|
||||||
{
|
{
|
||||||
|
case EGirdOrientation.Horizontal:
|
||||||
gridMain.Visibility = Visibility.Visible;
|
gridMain.Visibility = Visibility.Visible;
|
||||||
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabMsgView.Visibility).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies.Visibility).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies.Visibility).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections.Visibility).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections.Visibility).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain.SelectedIndex).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain.SelectedIndex).DisposeWith(disposables);
|
||||||
}
|
break;
|
||||||
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
|
|
||||||
{
|
case EGirdOrientation.Vertical:
|
||||||
gridMain1.Visibility = Visibility.Visible;
|
gridMain1.Visibility = Visibility.Visible;
|
||||||
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabMsgView1.Visibility).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies1.Visibility).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies1.Visibility).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections1.Visibility).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections1.Visibility).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain1.SelectedIndex).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain1.SelectedIndex).DisposeWith(disposables);
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
case EGirdOrientation.Tab:
|
||||||
|
default:
|
||||||
gridMain2.Visibility = Visibility.Visible;
|
gridMain2.Visibility = Visibility.Visible;
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies2.Visibility).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies2.Visibility).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections2.Visibility).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections2.Visibility).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain2.SelectedIndex).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain2.SelectedIndex).DisposeWith(disposables);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue