From f11b46ed377532a39ab841cdfb35e500826e81da Mon Sep 17 00:00:00 2001 From: DHR60 Date: Sat, 6 Sep 2025 19:19:34 +0800 Subject: [PATCH] Fix --- .../ViewModels/ProfilesSelectViewModel.cs | 27 ++++++++++ .../Views/ProfilesSelectWindow.axaml | 7 ++- .../Views/ProfilesSelectWindow.axaml.cs | 52 ++++++++++++++++--- v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml | 2 + .../v2rayN/Views/ProfilesSelectWindow.xaml.cs | 26 +++++++++- 5 files changed, 103 insertions(+), 11 deletions(-) diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs index f3bc6817..8e2ecdbc 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs @@ -277,6 +277,33 @@ public class ProfilesSelectViewModel : MyReactiveObject return item; } + public async Task?> GetProfileItems() + { + if (SelectedProfiles == null || SelectedProfiles.Count == 0) + { + return null; + } + var lst = new List(); + foreach (var sp in SelectedProfiles) + { + if (string.IsNullOrEmpty(sp?.IndexId)) + { + continue; + } + var item = await AppManager.Instance.GetProfileItem(sp.IndexId); + if (item != null) + { + lst.Add(item); + } + } + if (lst.Count == 0) + { + NoticeManager.Instance.Enqueue(ResUI.PleaseSelectServer); + return null; + } + return lst; + } + public void SortServer(string colName) { if (colName.IsNullOrEmpty()) diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml b/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml index 9b41bc90..db5a017f 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml @@ -11,6 +11,7 @@ Width="800" Height="450" x:DataType="vms:ProfilesSelectViewModel" + WindowStartupLocation="CenterScreen" mc:Ignorable="d"> @@ -27,6 +28,7 @@