Browse Source

Code improvements

pull/5767/head
2dust 2 months ago
parent
commit
b008a58cf8
  1. 45
      v2rayN/v2rayN/Views/MainWindow.xaml.cs

45
v2rayN/v2rayN/Views/MainWindow.xaml.cs

@ -42,6 +42,28 @@ 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)
{
tabProfiles.Content ??= new ProfilesView();
tabMsgView.Content ??= new MsgView();
tabClashProxies.Content ??= new ClashProxiesView();
tabClashConnections.Content ??= new ClashConnectionsView();
}
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
{
tabProfiles1.Content ??= new ProfilesView();
tabMsgView1.Content ??= new MsgView();
tabClashProxies1.Content ??= new ClashProxiesView();
tabClashConnections1.Content ??= new ClashConnectionsView();
}
else
{
tabProfiles2.Content ??= new ProfilesView();
tabMsgView2.Content ??= new MsgView();
tabClashProxies2.Content ??= new ClashProxiesView();
tabClashConnections2.Content ??= new ClashConnectionsView();
}
pbTheme.Content ??= new ThemeSettingView();
this.WhenActivated(disposables => this.WhenActivated(disposables =>
{ {
@ -151,29 +173,6 @@ namespace v2rayN.Views
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
} }
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
{
tabProfiles.Content ??= new ProfilesView();
tabMsgView.Content ??= new MsgView();
tabClashProxies.Content ??= new ClashProxiesView();
tabClashConnections.Content ??= new ClashConnectionsView();
}
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
{
tabProfiles1.Content ??= new ProfilesView();
tabMsgView1.Content ??= new MsgView();
tabClashProxies1.Content ??= new ClashProxiesView();
tabClashConnections1.Content ??= new ClashConnectionsView();
}
else
{
tabProfiles2.Content ??= new ProfilesView();
tabMsgView2.Content ??= new MsgView();
tabClashProxies2.Content ??= new ClashProxiesView();
tabClashConnections2.Content ??= new ClashConnectionsView();
}
pbTheme.Content ??= new ThemeSettingView();
RestoreUI(); RestoreUI();
AddHelpMenuItem(); AddHelpMenuItem();
} }

Loading…
Cancel
Save