mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-05-01 07:30:43 +02:00
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using Borepin.Model;
|
|
using Borepin.Service;
|
|
using Prism.Mvvm;
|
|
using Prism.Navigation;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Text;
|
|
using System.Windows.Input;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Borepin.PageModel
|
|
{
|
|
public class MachinesPageModel : BindableBase
|
|
{
|
|
private INavigationService _navigationService;
|
|
|
|
public MachinesPageModel(INavigationService navigationService)
|
|
{
|
|
_navigationService = navigationService;
|
|
GoToMachineCommand = new Command<object>(GoToMachineCommandExecuted);
|
|
|
|
MachineList = new ObservableCollection<Machine>(BFFHService.GetMachines());
|
|
}
|
|
|
|
private ICommand _GoToMachineCommand;
|
|
public ICommand GoToMachineCommand
|
|
{
|
|
get => _GoToMachineCommand;
|
|
set => SetProperty(ref _GoToMachineCommand, value);
|
|
}
|
|
|
|
private async void GoToMachineCommandExecuted(object obj)
|
|
{
|
|
Machine machine = obj as Machine;
|
|
|
|
NavigationParameters navigationParams = new NavigationParameters();
|
|
navigationParams.Add("machineID", machine.ID);
|
|
|
|
INavigationResult result = await _navigationService.NavigateAsync($"MachinePage", navigationParams);
|
|
if (!result.Success)
|
|
{
|
|
System.Diagnostics.Debugger.Break();
|
|
}
|
|
}
|
|
|
|
private ObservableCollection<Machine> _MachineList;
|
|
public ObservableCollection<Machine> MachineList
|
|
{
|
|
get => _MachineList;
|
|
set => SetProperty(ref _MachineList, value);
|
|
}
|
|
}
|
|
}
|