From 84b91e9649a26d6f66d7857adc1fd8056d94df66 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Tue, 31 Jan 2023 13:25:52 +0800 Subject: [PATCH] Fix activity node display --- v2rayN/v2rayN/Handler/LazyConfig.cs | 3 +-- v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index bd2fa7f2..ee705f67 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -85,8 +85,7 @@ namespace v2rayN.Handler public List ProfileItems(string subid, string filter) { var sql = @$"select a.* - ,b.remarks subRemarks - ,case when a.indexId = '{_config.indexId}' then true else false end isActive + ,b.remarks subRemarks from ProfileItem a left join SubItem b on a.subid = b.id where 1=1 "; diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index c484e0d8..f327e35f 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -684,6 +684,8 @@ namespace v2rayN.ViewModels List lstModel = LazyConfig.Instance.ProfileItems(_subId, _serverFilter); _lstProfile = Utils.FromJson>(Utils.ToJson(lstModel)); + ConfigHandler.SetDefaultServer(_config, _lstProfile); + List lstServerStat = new(); if (_statistics != null && _statistics.Enable) { @@ -704,7 +706,7 @@ namespace v2rayN.ViewModels network = t.network, streamSecurity = t.streamSecurity, subRemarks = t.subRemarks, - isActive = t.isActive, + isActive = t.indexId == _config.indexId, delay = t.delay, delayVal = t.delay != 0 ? $"{t.delay} {Global.DelayUnit}" : string.Empty, speedVal = t.speed != 0 ? $"{t.speed} {Global.SpeedUnit}" : string.Empty, @@ -714,8 +716,6 @@ namespace v2rayN.ViewModels totalUp = t22 == null ? "" : Utils.HumanFy(t22.totalUp) }).ToList(); - ConfigHandler.SetDefaultServer(_config, _lstProfile); - Application.Current.Dispatcher.Invoke((Action)(() => { _profileItems.Clear(); @@ -1134,7 +1134,7 @@ namespace v2rayN.ViewModels if (sb.Length > 0) { Utils.SetClipboardData(sb.ToString()); - _noticeHandler?.Enqueue(ResUI.BatchExportURLSuccessfully); + _noticeHandler?.SendMessage(ResUI.BatchExportURLSuccessfully); } } @@ -1159,7 +1159,7 @@ namespace v2rayN.ViewModels if (sb.Length > 0) { Utils.SetClipboardData(Utils.Base64Encode(sb.ToString())); - _noticeHandler?.Enqueue(ResUI.BatchExportSubscriptionSuccessfully); + _noticeHandler?.SendMessage(ResUI.BatchExportSubscriptionSuccessfully); } }