mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-09 06:59:53 +03:00
Code optimization, function asynchrony
This commit is contained in:
@@ -25,13 +25,8 @@ namespace ServiceLib.ViewModels
|
||||
public SubSettingViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
{
|
||||
_config = AppHandler.Instance.Config;
|
||||
|
||||
_updateView = updateView;
|
||||
|
||||
SelectedSource = new();
|
||||
|
||||
RefreshSubItems();
|
||||
|
||||
var canEditRemove = this.WhenAnyValue(
|
||||
x => x.SelectedSource,
|
||||
selectedSource => selectedSource != null && !selectedSource.id.IsNullOrEmpty());
|
||||
@@ -52,6 +47,15 @@ namespace ServiceLib.ViewModels
|
||||
{
|
||||
await _updateView?.Invoke(EViewAction.ShareSub, SelectedSource?.url);
|
||||
}, canEditRemove);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
private async Task Init()
|
||||
{
|
||||
SelectedSource = new();
|
||||
|
||||
await RefreshSubItems();
|
||||
}
|
||||
|
||||
public async Task RefreshSubItems()
|
||||
|
||||
Reference in New Issue
Block a user