diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index 299fc9e3..da9a3747 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -259,8 +259,6 @@ namespace v2rayN.ViewModels Locator.CurrentMutable.RegisterLazySingleton(() => new NoticeHandler(snackbarMessageQueue), typeof(NoticeHandler)); _noticeHandler = Locator.Current.GetService(); _config = LazyConfig.Instance.GetConfig(); - //ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false); - Init(); SelectedProfile = new(); SelectedSub = new(); @@ -273,9 +271,11 @@ namespace v2rayN.ViewModels } _subId = _config.subIndexId; - InitSubscriptionView(); - RefreshRoutingsMenu(); - RefreshServers(); + Init(); + BindingUI(); + RestoreUI(); + + #region WhenAnyValue && ReactiveCommand var canEditRemove = this.WhenAnyValue( x => x.SelectedProfile, @@ -316,10 +316,6 @@ namespace v2rayN.ViewModels y => y == true) .Subscribe(c => DoEnableTun(c)); - BindingUI(); - RestoreUI(); - AutoHideStartup(); - //servers AddVmessServerCmd = ReactiveCommand.Create(() => { @@ -573,6 +569,10 @@ namespace v2rayN.ViewModels SetListenerType(ESysProxyType.Pac); }); + #endregion WhenAnyValue && ReactiveCommand + + AutoHideStartup(); + Global.ShowInTaskbar = true; } @@ -591,6 +591,10 @@ namespace v2rayN.ViewModels MainFormHandler.Instance.UpdateTask(_config, UpdateTaskHandler); MainFormHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, UpdateTaskHandler); + InitSubscriptionView(); + RefreshRoutingsMenu(); + RefreshServers(); + Reload(); ChangeSystemProxyStatus(_config.sysProxyType, true); } @@ -1864,7 +1868,7 @@ namespace v2rayN.ViewModels if (_config.uiItem.autoHideStartup) { Observable.Range(1, 1) - .Delay(TimeSpan.FromSeconds(0.5)) + .Delay(TimeSpan.FromSeconds(1)) .Subscribe(x => { Application.Current.Dispatcher.Invoke(() => diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml index a869b762..0332cac0 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml @@ -193,7 +193,6 @@ x:Name="btnBrowse" Grid.Row="3" Grid.Column="2" - Width="100" Margin="2,0,8,0" Click="btnBrowse_Click" Content="{x:Static resx:ResUI.TbBrowse}"