Skip to content

Commit b008a58

Browse files
committed
Code improvements
1 parent 8e02394 commit b008a58

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

v2rayN/v2rayN/Views/MainWindow.xaml.cs

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ public MainWindow()
4242
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel));
4343

4444
WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
45+
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
46+
{
47+
tabProfiles.Content ??= new ProfilesView();
48+
tabMsgView.Content ??= new MsgView();
49+
tabClashProxies.Content ??= new ClashProxiesView();
50+
tabClashConnections.Content ??= new ClashConnectionsView();
51+
}
52+
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
53+
{
54+
tabProfiles1.Content ??= new ProfilesView();
55+
tabMsgView1.Content ??= new MsgView();
56+
tabClashProxies1.Content ??= new ClashProxiesView();
57+
tabClashConnections1.Content ??= new ClashConnectionsView();
58+
}
59+
else
60+
{
61+
tabProfiles2.Content ??= new ProfilesView();
62+
tabMsgView2.Content ??= new MsgView();
63+
tabClashProxies2.Content ??= new ClashProxiesView();
64+
tabClashConnections2.Content ??= new ClashConnectionsView();
65+
}
66+
pbTheme.Content ??= new ThemeSettingView();
4567

4668
this.WhenActivated(disposables =>
4769
{
@@ -150,30 +172,7 @@ public MainWindow()
150172
{
151173
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
152174
}
153-
154-
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
155-
{
156-
tabProfiles.Content ??= new ProfilesView();
157-
tabMsgView.Content ??= new MsgView();
158-
tabClashProxies.Content ??= new ClashProxiesView();
159-
tabClashConnections.Content ??= new ClashConnectionsView();
160-
}
161-
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
162-
{
163-
tabProfiles1.Content ??= new ProfilesView();
164-
tabMsgView1.Content ??= new MsgView();
165-
tabClashProxies1.Content ??= new ClashProxiesView();
166-
tabClashConnections1.Content ??= new ClashConnectionsView();
167-
}
168-
else
169-
{
170-
tabProfiles2.Content ??= new ProfilesView();
171-
tabMsgView2.Content ??= new MsgView();
172-
tabClashProxies2.Content ??= new ClashProxiesView();
173-
tabClashConnections2.Content ??= new ClashConnectionsView();
174-
}
175-
pbTheme.Content ??= new ThemeSettingView();
176-
175+
177176
RestoreUI();
178177
AddHelpMenuItem();
179178
}

0 commit comments

Comments
 (0)