mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-26 04:46:56 +00:00
updateSubscription and try to re-select the last choice.
This commit is contained in:
parent
672eb4b365
commit
1d3b5452a5
2 changed files with 22 additions and 3 deletions
|
@ -1316,9 +1316,28 @@ namespace v2rayN.Forms
|
|||
|
||||
private void tsbSubUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateSubscriptionProcess();
|
||||
VmessItem item = config.vmess[config.index];
|
||||
var remarks = item.remarks;
|
||||
var handle = new UpdateHandle();
|
||||
void _updateUIAndReselect(bool success, string msg)
|
||||
{
|
||||
AppendText(false, msg);
|
||||
if (success)
|
||||
{
|
||||
RefreshServers();
|
||||
}
|
||||
if (handle.updateSubscriptionProcessCompleted)
|
||||
{
|
||||
// wait for above fxcking async program to complete
|
||||
int index = FindIndexByRemarks(remarks);
|
||||
SetDefaultServer(index);
|
||||
AppendText(false, $"{UIRes.I18N("MsgUpdateSubscriptionEndReslectLast")}");
|
||||
RefreshServers();
|
||||
handle.updateSubscriptionProcessCompleted = false;
|
||||
}
|
||||
};
|
||||
handle.UpdateSubscriptionProcess(config, _updateUIAndReselect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the subscription update process
|
||||
/// </summary>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace v2rayN.Handler
|
|||
{
|
||||
Action<bool, string> _updateFunc;
|
||||
private Config _config;
|
||||
|
||||
public bool updateSubscriptionProcessCompleted = false;
|
||||
public event EventHandler<ResultEventArgs> AbsoluteCompleted;
|
||||
|
||||
public class ResultEventArgs : EventArgs
|
||||
|
|
Loading…
Reference in a new issue