diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs index 219a9ff8..ff6d787f 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs @@ -89,20 +89,6 @@ public class ProfilesSelectViewModel : MyReactiveObject #endregion WhenAnyValue && ReactiveCommand - #region AppEvents - - AppEvents.ProfilesRefreshRequested - .AsObservable() - .ObserveOn(RxApp.MainThreadScheduler) - .Subscribe(async _ => await RefreshServersBiz()); - - AppEvents.DispatcherStatisticsRequested - .AsObservable() - .ObserveOn(RxApp.MainThreadScheduler) - .Subscribe(UpdateStatistics); - - #endregion AppEvents - _ = Init(); } @@ -130,42 +116,6 @@ public class ProfilesSelectViewModel : MyReactiveObject #region Actions - public void UpdateStatistics(ServerSpeedItem update) - { - if (!_config.GuiItem.EnableStatistics - || (update.ProxyUp + update.ProxyDown) <= 0 - || DateTime.Now.Second % 3 != 0) - { - return; - } - - try - { - var item = ProfileItems.FirstOrDefault(it => it.IndexId == update.IndexId); - if (item != null) - { - item.TodayDown = Utils.HumanFy(update.TodayDown); - item.TodayUp = Utils.HumanFy(update.TodayUp); - item.TotalDown = Utils.HumanFy(update.TotalDown); - item.TotalUp = Utils.HumanFy(update.TotalUp); - - //if (SelectedProfile?.IndexId == item.IndexId) - //{ - // var temp = JsonUtils.DeepCopy(item); - // _profileItems.Replace(item, temp); - // SelectedProfile = temp; - //} - //else - //{ - // _profileItems.Replace(item, JsonUtils.DeepCopy(item)); - //} - } - } - catch - { - } - } - public bool CanOk() { return SelectedProfile != null && !SelectedProfile.IndexId.IsNullOrEmpty(); @@ -264,13 +214,7 @@ public class ProfilesSelectViewModel : MyReactiveObject //await ConfigHandler.SetDefaultServer(_config, lstModel); - var lstServerStat = (_config.GuiItem.EnableStatistics ? StatisticsManager.Instance.ServerStat : null) ?? []; - var lstProfileExs = await ProfileExManager.Instance.GetProfileExs(); lstModel = (from t in lstModel - join t2 in lstServerStat on t.IndexId equals t2.IndexId into t2b - from t22 in t2b.DefaultIfEmpty() - join t3 in lstProfileExs on t.IndexId equals t3.IndexId into t3b - from t33 in t3b.DefaultIfEmpty() select new ProfileItemModel { IndexId = t.IndexId, @@ -284,15 +228,6 @@ public class ProfilesSelectViewModel : MyReactiveObject Subid = t.Subid, SubRemarks = t.SubRemarks, IsActive = t.IndexId == _config.IndexId, - Sort = t33?.Sort ?? 0, - Delay = t33?.Delay ?? 0, - Speed = t33?.Speed ?? 0, - DelayVal = t33?.Delay != 0 ? $"{t33?.Delay}" : string.Empty, - SpeedVal = t33?.Speed > 0 ? $"{t33?.Speed}" : t33?.Message ?? string.Empty, - TodayDown = t22 == null ? "" : Utils.HumanFy(t22.TodayDown), - TodayUp = t22 == null ? "" : Utils.HumanFy(t22.TodayUp), - TotalDown = t22 == null ? "" : Utils.HumanFy(t22.TotalDown), - TotalUp = t22 == null ? "" : Utils.HumanFy(t22.TotalUp) }).OrderBy(t => t.Sort).ToList(); // Apply ConfigType filter (include or exclude) diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml b/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml index db5a017f..abe98176 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml @@ -2,7 +2,6 @@ x:Class="v2rayN.Desktop.Views.ProfilesSelectWindow" xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:conv="using:v2rayN.Desktop.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" @@ -14,10 +13,6 @@ WindowStartupLocation="CenterScreen" mc:Ignorable="d"> - - - - - + @@ -133,49 +128,6 @@ Binding="{Binding SubRemarks}" Header="{x:Static resx:ResUI.LvSubscription}" Tag="SubRemarks" /> - - - - - - - - - - - - - - - - - - diff --git a/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml b/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml index a4827843..453d8c03 100644 --- a/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml +++ b/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml @@ -3,7 +3,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:base="clr-namespace:v2rayN.Base" - xmlns:conv="clr-namespace:v2rayN.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -18,13 +17,6 @@ WindowStartupLocation="CenterScreen" mc:Ignorable="d"> - - - - - - - - - - - - - - - - - - - - - -