Finalized Maui-series for vs development
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using AdventureWorks.EntityLayer;
|
||||
using AdventureWorks.ViewModelLayer.ViewModelClasses;
|
||||
using Common.Library;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AdventureWorks.MAUI.CommandClasses
|
||||
{
|
||||
@ -14,6 +15,44 @@ namespace AdventureWorks.MAUI.CommandClasses
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
public ICommand SaveCommand { get; private set; }
|
||||
public ICommand EditCommand { get; private set; }
|
||||
|
||||
private bool _IsSaveCommandEnabled = true;
|
||||
public bool IsSaveCommandEnabled
|
||||
{
|
||||
get { return _IsSaveCommandEnabled; }
|
||||
set
|
||||
{
|
||||
_IsSaveCommandEnabled = value;
|
||||
RaisePropertyChanged(nameof(IsSaveCommandEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
SaveCommand = new Command(async () => await SaveAsync(), () => IsSaveCommandEnabled);
|
||||
EditCommand = new Command<int>(async (id) => await EditAsync(id), (id) => id > 0);
|
||||
}
|
||||
|
||||
public async Task<bool> SaveAsync()
|
||||
{
|
||||
var ret = base.Save();
|
||||
if (ret)
|
||||
{
|
||||
await Shell.Current.GoToAsync("..");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected async Task EditAsync(int id)
|
||||
{
|
||||
await Shell.Current.GoToAsync($"{nameof(Views.ProductDetailView)}?id={id}");
|
||||
}
|
||||
|
||||
public void LoadProducts()
|
||||
{
|
||||
Get();
|
||||
|
||||
Reference in New Issue
Block a user