From 33dcef2285847c4e73cb7d98247cb16fbc6bb108 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sat, 4 Feb 2023 18:52:17 +0800 Subject: [PATCH] Optimize Update Subscription --- .../v2rayN/ViewModels/MainWindowViewModel.cs | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index 58cc3650..84d3645a 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -537,7 +537,12 @@ namespace v2rayN.ViewModels _noticeHandler?.SendMessage(msg); if (success) { + RefreshServers(); Reload(); + if (_config.uiItem.enableAutoAdjustMainLvColWidth) + { + _updateView("AdjustMainLvColWidth"); + } } } private void UpdateStatisticsHandler(ServerSpeedItem update) @@ -1220,21 +1225,8 @@ namespace v2rayN.ViewModels } private void UpdateSubscriptionProcess(string subId, bool blProxy) - { - void _updateUI(bool success, string msg) - { - _noticeHandler?.SendMessage(msg); - if (success) - { - RefreshServers(); - if (_config.uiItem.enableAutoAdjustMainLvColWidth) - { - _updateView("AdjustMainLvColWidth"); - } - } - }; - - (new UpdateHandle()).UpdateSubscriptionProcess(_config, subId, blProxy, _updateUI); + { + (new UpdateHandle()).UpdateSubscriptionProcess(_config, subId, blProxy, UpdateTaskHandler); } #endregion