Code optimization, function asynchrony
This commit is contained in:
@@ -17,9 +17,13 @@ namespace ServiceLib.ViewModels
|
||||
public AddServerViewModel(ProfileItem profileItem, Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
{
|
||||
_config = AppHandler.Instance.Config;
|
||||
|
||||
_updateView = updateView;
|
||||
|
||||
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await SaveServerAsync();
|
||||
});
|
||||
|
||||
if (profileItem.indexId.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.network = Global.DefaultNetwork;
|
||||
@@ -33,11 +37,6 @@ namespace ServiceLib.ViewModels
|
||||
SelectedSource = JsonUtils.DeepCopy(profileItem);
|
||||
}
|
||||
CoreType = SelectedSource?.coreType?.ToString();
|
||||
|
||||
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await SaveServerAsync();
|
||||
});
|
||||
}
|
||||
|
||||
private async Task SaveServerAsync()
|
||||
|
||||
Reference in New Issue
Block a user