mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 11:59:13 +00:00
Adjust ActionPrecheckManager
This commit is contained in:
parent
91af50f99a
commit
6771eb25d1
3 changed files with 23 additions and 19 deletions
|
@ -10,7 +10,7 @@ public class ActionPrecheckManager(Config config)
|
||||||
|
|
||||||
private readonly Config _config = config;
|
private readonly Config _config = config;
|
||||||
|
|
||||||
public async Task<List<string>> CheckBeforeSetActive(string? indexId)
|
public async Task<List<string>> Check(string? indexId)
|
||||||
{
|
{
|
||||||
if (indexId.IsNullOrEmpty())
|
if (indexId.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
@ -23,10 +23,10 @@ public class ActionPrecheckManager(Config config)
|
||||||
return [ResUI.PleaseSelectServer];
|
return [ResUI.PleaseSelectServer];
|
||||||
}
|
}
|
||||||
|
|
||||||
return await CheckBeforeGenerateConfig(item);
|
return await Check(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<string>> CheckBeforeGenerateConfig(ProfileItem? item)
|
public async Task<List<string>> Check(ProfileItem? item)
|
||||||
{
|
{
|
||||||
if (item is null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -538,6 +538,18 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
|
|
||||||
BlReloadEnabled = false;
|
BlReloadEnabled = false;
|
||||||
|
|
||||||
|
var msgs = await ActionPrecheckManager.Instance.Check(_config.IndexId);
|
||||||
|
if (msgs.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var msg in msgs)
|
||||||
|
{
|
||||||
|
NoticeManager.Instance.SendMessage(msg);
|
||||||
|
}
|
||||||
|
NoticeManager.Instance.Enqueue(Utils.List2String(msgs));
|
||||||
|
BlReloadEnabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await Task.Run(async () =>
|
await Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await LoadCore();
|
await LoadCore();
|
||||||
|
|
|
@ -605,16 +605,6 @@ public class ProfilesViewModel : MyReactiveObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var msgs = await ActionPrecheckManager.Instance.CheckBeforeSetActive(indexId);
|
|
||||||
foreach (var msg in msgs)
|
|
||||||
{
|
|
||||||
NoticeManager.Instance.SendMessage(msg);
|
|
||||||
}
|
|
||||||
if (msgs.Count > 0)
|
|
||||||
{
|
|
||||||
NoticeManager.Instance.Enqueue(msgs.First());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await ConfigHandler.SetDefaultServerIndex(_config, indexId) == 0)
|
if (await ConfigHandler.SetDefaultServerIndex(_config, indexId) == 0)
|
||||||
{
|
{
|
||||||
await RefreshServers();
|
await RefreshServers();
|
||||||
|
@ -779,15 +769,17 @@ public class ProfilesViewModel : MyReactiveObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var msgs = await ActionPrecheckManager.Instance.CheckBeforeGenerateConfig(item);
|
var msgs = await ActionPrecheckManager.Instance.Check(item);
|
||||||
|
if (msgs.Count > 0)
|
||||||
|
{
|
||||||
foreach (var msg in msgs)
|
foreach (var msg in msgs)
|
||||||
{
|
{
|
||||||
NoticeManager.Instance.SendMessage(msg);
|
NoticeManager.Instance.SendMessage(msg);
|
||||||
}
|
}
|
||||||
if (msgs.Count > 0)
|
NoticeManager.Instance.Enqueue(Utils.List2String(msgs));
|
||||||
{
|
return;
|
||||||
NoticeManager.Instance.Enqueue(msgs.First());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blClipboard)
|
if (blClipboard)
|
||||||
{
|
{
|
||||||
var result = await CoreConfigHandler.GenerateClientConfig(item, null);
|
var result = await CoreConfigHandler.GenerateClientConfig(item, null);
|
||||||
|
|
Loading…
Reference in a new issue