Finalized Maui-series for vs development

This commit is contained in:
2025-08-21 22:08:06 +02:00
parent 543b9c2aaf
commit 8b7afd50a4
10 changed files with 95 additions and 13 deletions

View File

@ -38,16 +38,34 @@ public class UserViewModelCommands : UserViewModel
#region Commands
public ICommand SaveCommand { get; private set; }
public ICommand EditCommand { get; private set; }
#endregion
#region Init Method
public override void Init()
{
base.Init();
SaveCommand = new Command(() => Save(), () => IsSaveCommandEnabled);
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
EditCommand = new Command<int>(async (id) => await EditAsync(id), (id) => id > 0);
}
#endregion
protected async Task EditAsync(int id)
{
await Shell.Current.GoToAsync($"{nameof(Views.UserDetailView)}?id={id}");
}
public async Task<bool> SaveAsync()
{
var ret = base.Save();
if (ret)
{
await Shell.Current.GoToAsync("..");
}
return ret;
}
}