From fb92b90d5c06e8e06e9f725c1e1471e556d5a1dc Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:58:54 +0800 Subject: [PATCH] Bug fix https://github.com/2dust/v2rayN/issues/5909 --- .../ViewModels/StatusBarViewModel.cs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index e0af705d..70de9685 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -104,6 +104,18 @@ namespace ServiceLib.ViewModels public StatusBarViewModel(Func>? updateView) { _config = AppHandler.Instance.Config; + SelectedRouting = new(); + SelectedServer = new(); + RunningServerToolTipText = "-"; + + if (_config.TunModeItem.EnableTun && AppHandler.Instance.IsAdministrator) + { + EnableTun = true; + } + else + { + _config.TunModeItem.EnableTun = EnableTun = false; + } #region WhenAnyValue && ReactiveCommand @@ -179,19 +191,6 @@ namespace ServiceLib.ViewModels private async Task Init() { - SelectedRouting = new(); - SelectedServer = new(); - RunningServerToolTipText = "-"; - - if (_config.TunModeItem.EnableTun && AppHandler.Instance.IsAdministrator) - { - EnableTun = true; - } - else - { - _config.TunModeItem.EnableTun = EnableTun = false; - } - await RefreshRoutingsMenu(); await InboundDisplayStatus(); await ChangeSystemProxyAsync(_config.SystemProxyItem.SysProxyType, true);