mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-16 10:14:59 +03:00
Code optimization, function asynchrony
This commit is contained in:
@@ -14,27 +14,19 @@ namespace ServiceLib.ViewModels
|
||||
public SubEditViewModel(SubItem subItem, Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
{
|
||||
_config = AppHandler.Instance.Config;
|
||||
|
||||
_updateView = updateView;
|
||||
|
||||
if (subItem.id.IsNullOrEmpty())
|
||||
{
|
||||
SelectedSource = subItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedSource = JsonUtils.DeepCopy(subItem);
|
||||
}
|
||||
|
||||
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await SaveSubAsync();
|
||||
});
|
||||
|
||||
SelectedSource = subItem.id.IsNullOrEmpty() ? subItem : JsonUtils.DeepCopy(subItem);
|
||||
}
|
||||
|
||||
private async Task SaveSubAsync()
|
||||
{
|
||||
string remarks = SelectedSource.remarks;
|
||||
var remarks = SelectedSource.remarks;
|
||||
if (Utils.IsNullOrEmpty(remarks))
|
||||
{
|
||||
NoticeHandler.Instance.Enqueue(ResUI.PleaseFillRemarks);
|
||||
|
||||
Reference in New Issue
Block a user