This commit is contained in:
rmbgame
2021-04-27 02:54:36 +08:00
parent 22b1de660f
commit 1553dcec30
3 changed files with 12 additions and 18 deletions
@@ -75,23 +75,14 @@ namespace System.Application.UI.ViewModels
await Task.CompletedTask;
}
protected bool IsFirstActivation = true;
internal async virtual void Activation()
{
await Task.CompletedTask;
}
internal bool _IsFirstActivation = true;
internal void FirstActivation()
{
if (_IsFirstActivation)
if (IsFirstActivation)
{
ActivationOnFirst();
_IsFirstActivation = false;
IsFirstActivation = false;
}
}
internal async virtual void ActivationOnFirst()
{
await Task.CompletedTask;
}
}
@@ -102,8 +102,6 @@ namespace System.Application.UI.ViewModels
this.WhenAnyValue(x => x.SelectedItem)
.Subscribe(x =>
{
if (x._IsFirstActivation)
Task.Run(x.FirstActivation).ForgetAndDispose();
Task.Run(x.Activation).ForgetAndDispose();
});
}
@@ -22,11 +22,16 @@ namespace System.Application.UI.ViewModels
get => AppResources.ScriptConfig;
protected set { throw new NotImplementedException(); }
}
internal override void ActivationOnFirst()
internal override void Activation()
{
if (ProxySettings.IsAutoCheckScriptUpdate)
ProxyService.Current.CheckUpdate();
base.Activation();
if (IsFirstActivation)
if (ProxySettings.IsAutoCheckScriptUpdate)
ProxyService.Current.CheckUpdate();
}
private readonly ReadOnlyObservableCollection<ScriptDTO> _ProxyScripts;
public ReadOnlyObservableCollection<ScriptDTO> ProxyScripts => _ProxyScripts;