diff --git a/v2rayN/v2rayN.Desktop/Common/SimpleViewLocator.cs b/v2rayN/v2rayN.Desktop/Common/SimpleViewLocator.cs index f589a245..e4b883ae 100644 --- a/v2rayN/v2rayN.Desktop/Common/SimpleViewLocator.cs +++ b/v2rayN/v2rayN.Desktop/Common/SimpleViewLocator.cs @@ -70,7 +70,8 @@ public class SimpleViewLocator : IDataTemplate { return vmType == typeof(MsgViewModel) || vmType == typeof(ClashProxiesViewModel) - || vmType == typeof(ClashConnectionsViewModel); + || vmType == typeof(ClashConnectionsViewModel) + || vmType == typeof(ProfilesViewModel); } private static Control CreateView(Func factory, Type vmType) diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index 4a0260df..b06a599f 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -405,6 +405,8 @@ public partial class MainWindow : WindowBase var currentLayoutDisposables = new MultipleDisposable(); _layoutBindingsDisposable.Create(currentLayoutDisposables); + ClearLayoutContent(); + gridMain.IsVisible = orientation == EGirdOrientation.Horizontal; gridMain1.IsVisible = orientation == EGirdOrientation.Vertical; gridMain2.IsVisible = orientation == EGirdOrientation.Tab; @@ -445,22 +447,40 @@ public partial class MainWindow : WindowBase break; } - // workaround - Task.Run(async () => - { - await Task.Delay(5000); - Dispatcher.UIThread.Post(() => - { - ViewModel?.TabMainSelectedIndex = 0; - tabMain.SelectedIndex = 0; - tabMain1.SelectedIndex = 0; - tabMain2.SelectedIndex = 0; - }); - }); + //// workaround + //Task.Run(async () => + //{ + // await Task.Delay(5000); + // Dispatcher.UIThread.Post(() => + // { + // ViewModel?.TabMainSelectedIndex = 0; + // tabMain.SelectedIndex = 0; + // tabMain1.SelectedIndex = 0; + // tabMain2.SelectedIndex = 0; + // }); + //}); RestoreUI(); } + private void ClearLayoutContent() + { + tabProfiles.Content = null; + tabMsgView.Content = null; + tabClashProxies.Content = null; + tabClashConnections.Content = null; + + tabProfiles1.Content = null; + tabMsgView1.Content = null; + tabClashProxies1.Content = null; + tabClashConnections1.Content = null; + + tabProfiles2.Content = null; + tabMsgView2.Content = null; + tabClashProxies2.Content = null; + tabClashConnections2.Content = null; + } + private void AddHelpMenuItem() { var coreInfo = CoreInfoManager.Instance.GetCoreInfo();