mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
116 lines
3.0 KiB
C#
116 lines
3.0 KiB
C#
using Borepin.Base;
|
|
using Borepin.Model;
|
|
using Prism.Commands;
|
|
using Prism.Navigation;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
|
|
namespace Borepin.PageModel
|
|
{
|
|
public class MachinePageModel : PageModelBase
|
|
{
|
|
#region Contructors
|
|
public MachinePageModel(INavigationService navigationService) : base(navigationService)
|
|
{
|
|
UseMachineCommand = new DelegateCommand(UseMachineCommandExecuted);
|
|
GiveBackMachineCommand = new DelegateCommand(GiveBackMachineCommandExecuted);
|
|
}
|
|
#endregion
|
|
|
|
#region Data
|
|
public override Task LoadData()
|
|
{
|
|
//Name = MachineItem.MInfo.Name;
|
|
|
|
IsBusy = false;
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
//private Machine _MachineItem;
|
|
//public Machine MachineItem
|
|
//{
|
|
// get => _MachineItem;
|
|
// set => SetProperty(ref _MachineItem, value);
|
|
//}
|
|
|
|
private string _Name;
|
|
public string Name
|
|
{
|
|
get => _Name;
|
|
set => SetProperty(ref _Name, value);
|
|
}
|
|
|
|
private bool _CanUse;
|
|
public bool CanUse
|
|
{
|
|
get => _CanUse;
|
|
set => SetProperty(ref _CanUse, value);
|
|
}
|
|
|
|
private bool _CanGiveBack;
|
|
public bool CanGiveBack
|
|
{
|
|
get => _CanGiveBack;
|
|
set => SetProperty(ref _CanGiveBack, value);
|
|
}
|
|
#endregion
|
|
|
|
#region Commands
|
|
private ICommand _UseMachineCommand;
|
|
public ICommand UseMachineCommand
|
|
{
|
|
get => _UseMachineCommand;
|
|
set => SetProperty(ref _UseMachineCommand, value);
|
|
}
|
|
|
|
private async void UseMachineCommandExecuted()
|
|
{
|
|
//GiveBack = await MachineItem.Instance.Use();
|
|
//CanGiveBack = GiveBack != null;
|
|
|
|
//MachineItem.MInfo = await MachineItem.Instance.GetMInfo();
|
|
|
|
//CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.Machine.MachineState.free;
|
|
}
|
|
|
|
private ICommand _GiveBackMachineCommand;
|
|
public ICommand GiveBackMachineCommand
|
|
{
|
|
get => _GiveBackMachineCommand;
|
|
set => SetProperty(ref _GiveBackMachineCommand, value);
|
|
}
|
|
|
|
private async void GiveBackMachineCommandExecuted()
|
|
{
|
|
//await GiveBack.Ret();
|
|
|
|
//GiveBack = null;
|
|
//CanGiveBack = GiveBack != null;
|
|
|
|
//MachineItem.MInfo = await MachineItem.Instance.GetMInfo();
|
|
|
|
//CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.Machine.MachineState.free;
|
|
}
|
|
#endregion
|
|
|
|
#region INavigationService
|
|
public override void OnNavigatedFrom(INavigationParameters parameters)
|
|
{
|
|
|
|
}
|
|
|
|
public override void OnNavigatedTo(INavigationParameters parameters)
|
|
{
|
|
//MachineItem = parameters["instance"] as Machine;
|
|
|
|
IsBusy = true;
|
|
Task.Run(LoadData);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|