Skip to content

Commit

Permalink
Improve
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Feb 1, 2024
1 parent f76b1a5 commit 57d9d8d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
24 changes: 14 additions & 10 deletions v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue, Action<EV
Locator.CurrentMutable.RegisterLazySingleton(() => new NoticeHandler(snackbarMessageQueue), typeof(NoticeHandler));
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
_config = LazyConfig.Instance.GetConfig();
//ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false);
Init();

SelectedProfile = new();
SelectedSub = new();
Expand All @@ -273,9 +271,11 @@ public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue, Action<EV
}
_subId = _config.subIndexId;

InitSubscriptionView();
RefreshRoutingsMenu();
RefreshServers();
Init();
BindingUI();
RestoreUI();

#region WhenAnyValue && ReactiveCommand

var canEditRemove = this.WhenAnyValue(
x => x.SelectedProfile,
Expand Down Expand Up @@ -316,10 +316,6 @@ public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue, Action<EV
y => y == true)
.Subscribe(c => DoEnableTun(c));

BindingUI();
RestoreUI();
AutoHideStartup();

//servers
AddVmessServerCmd = ReactiveCommand.Create(() =>
{
Expand Down Expand Up @@ -573,6 +569,10 @@ public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue, Action<EV
SetListenerType(ESysProxyType.Pac);
});

#endregion WhenAnyValue && ReactiveCommand

AutoHideStartup();

Global.ShowInTaskbar = true;
}

Expand All @@ -591,6 +591,10 @@ private void Init()
MainFormHandler.Instance.UpdateTask(_config, UpdateTaskHandler);
MainFormHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, UpdateTaskHandler);

InitSubscriptionView();
RefreshRoutingsMenu();
RefreshServers();

Reload();
ChangeSystemProxyStatus(_config.sysProxyType, true);
}
Expand Down Expand Up @@ -1864,7 +1868,7 @@ private void AutoHideStartup()
if (_config.uiItem.autoHideStartup)
{
Observable.Range(1, 1)
.Delay(TimeSpan.FromSeconds(0.5))
.Delay(TimeSpan.FromSeconds(1))
.Subscribe(x =>
{
Application.Current.Dispatcher.Invoke(() =>
Expand Down
1 change: 0 additions & 1 deletion v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 57d9d8d

Please sign in to comment.