pull/4711/head
2dust 10 months ago
parent f76b1a5363
commit 57d9d8ddb9

@ -259,8 +259,6 @@ namespace v2rayN.ViewModels
Locator.CurrentMutable.RegisterLazySingleton(() => new NoticeHandler(snackbarMessageQueue), typeof(NoticeHandler)); Locator.CurrentMutable.RegisterLazySingleton(() => new NoticeHandler(snackbarMessageQueue), typeof(NoticeHandler));
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.GetConfig();
//ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false);
Init();
SelectedProfile = new(); SelectedProfile = new();
SelectedSub = new(); SelectedSub = new();
@ -273,9 +271,11 @@ namespace v2rayN.ViewModels
} }
_subId = _config.subIndexId; _subId = _config.subIndexId;
InitSubscriptionView(); Init();
RefreshRoutingsMenu(); BindingUI();
RefreshServers(); RestoreUI();
#region WhenAnyValue && ReactiveCommand
var canEditRemove = this.WhenAnyValue( var canEditRemove = this.WhenAnyValue(
x => x.SelectedProfile, x => x.SelectedProfile,
@ -316,10 +316,6 @@ namespace v2rayN.ViewModels
y => y == true) y => y == true)
.Subscribe(c => DoEnableTun(c)); .Subscribe(c => DoEnableTun(c));
BindingUI();
RestoreUI();
AutoHideStartup();
//servers //servers
AddVmessServerCmd = ReactiveCommand.Create(() => AddVmessServerCmd = ReactiveCommand.Create(() =>
{ {
@ -573,6 +569,10 @@ namespace v2rayN.ViewModels
SetListenerType(ESysProxyType.Pac); SetListenerType(ESysProxyType.Pac);
}); });
#endregion WhenAnyValue && ReactiveCommand
AutoHideStartup();
Global.ShowInTaskbar = true; Global.ShowInTaskbar = true;
} }
@ -591,6 +591,10 @@ namespace v2rayN.ViewModels
MainFormHandler.Instance.UpdateTask(_config, UpdateTaskHandler); MainFormHandler.Instance.UpdateTask(_config, UpdateTaskHandler);
MainFormHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, UpdateTaskHandler); MainFormHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, UpdateTaskHandler);
InitSubscriptionView();
RefreshRoutingsMenu();
RefreshServers();
Reload(); Reload();
ChangeSystemProxyStatus(_config.sysProxyType, true); ChangeSystemProxyStatus(_config.sysProxyType, true);
} }
@ -1864,7 +1868,7 @@ namespace v2rayN.ViewModels
if (_config.uiItem.autoHideStartup) if (_config.uiItem.autoHideStartup)
{ {
Observable.Range(1, 1) Observable.Range(1, 1)
.Delay(TimeSpan.FromSeconds(0.5)) .Delay(TimeSpan.FromSeconds(1))
.Subscribe(x => .Subscribe(x =>
{ {
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>

@ -193,7 +193,6 @@
x:Name="btnBrowse" x:Name="btnBrowse"
Grid.Row="3" Grid.Row="3"
Grid.Column="2" Grid.Column="2"
Width="100"
Margin="2,0,8,0" Margin="2,0,8,0"
Click="btnBrowse_Click" Click="btnBrowse_Click"
Content="{x:Static resx:ResUI.TbBrowse}" Content="{x:Static resx:ResUI.TbBrowse}"

Loading…
Cancel
Save