diff --git a/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs b/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs index da18f0ce..813c3b9b 100644 --- a/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs @@ -234,21 +234,7 @@ namespace ServiceLib.ViewModels { return; } - - Process process = new() - { - StartInfo = new ProcessStartInfo - { - FileName = "v2rayUpgrade", - Arguments = fileName.AppendQuotes(), - WorkingDirectory = Utils.StartupPath() - } - }; - process.Start(); - if (process.Id > 0) - { - Locator.Current.GetService()?.MyAppExitAsync(false); - } + Locator.Current.GetService()?.V2rayUpgrade(fileName); } catch (Exception ex) { diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index f5a110ad..c11f6035 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -428,6 +428,24 @@ namespace ServiceLib.ViewModels } } + public async Task V2rayUpgrade(string fileName) + { + Process process = new() + { + StartInfo = new ProcessStartInfo + { + FileName = "v2rayUpgrade", + Arguments = fileName.AppendQuotes(), + WorkingDirectory = Utils.StartupPath() + } + }; + process.Start(); + if (process.Id > 0) + { + await MyAppExitAsync(false); + } + } + #endregion Actions #region Servers && Groups