using Borepin.Model; using Prism.Mvvm; using Prism.Navigation; using System.Collections.ObjectModel; using System.Windows.Input; using Xamarin.Forms; namespace Borepin.PageModel { public class MachinesPageModel : BindableBase { private readonly INavigationService _NavigationService; public MachinesPageModel(INavigationService navigationService) { _NavigationService = navigationService; GoToMachineCommand = new Command(GoToMachineCommandExecuted); } 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 { { "machineID", machine.ID } }; INavigationResult result = await _NavigationService.NavigateAsync($"MachinePage", navigationParams); if (!result.Success) { System.Diagnostics.Debugger.Break(); } } private ObservableCollection _MachineList; public ObservableCollection MachineList { get => _MachineList; set => SetProperty(ref _MachineList, value); } } }