public void GoToGame() { if (SelectedGame == null) { return; } var navigationService = new Services.NavigationService(); navigationService.GoToGame(SelectedGame.Id); SelectedGame = null; }
public FavoritePageViewModel() { SelectionChangedCommand = new Command <CollectionView>(execute: (CollectionView collectionView) => { if (collectionView.SelectedItem == null) { return; } var navigationService = new Services.NavigationService(); navigationService.GoToGame(((Models.JuegoFav)collectionView.SelectedItem).Id); collectionView.SelectedItem = null; }); }
public StartPageViewModel() { BarScannerVisible = false; PickerData = Enum.GetValues(typeof(JuegoOrderEnum)) .Cast <JuegoOrderEnum>().Select(v => v.GetStringValue()).ToList(); SelectionChangedCommand = new Command <CollectionView>(execute: (CollectionView collectionView) => { if (collectionView.SelectedItem == null) { return; } var navigationService = new Services.NavigationService(); navigationService.GoToGame(((Models.Juego)collectionView.SelectedItem).Id); collectionView.SelectedItem = null; }); RefreshCommand = new Command(execute: async() => { IsRefreshing = true; await LoadData(false); IsRefreshing = false; }); ThresholdReachedCommand = new Command(execute: async() => { if (LoadedElementCount >= MaxLoadedElements || IsLoadingMoreData) { return; } IsLoadingMoreData = true; await LoadData(true); IsLoadingMoreData = false; }); QRCommand = new Command(execute: () => { BarScannerVisible = !BarScannerVisible; }); ScanResultCommand = new Command <ZXing.Result>(execute: (ZXing.Result result) => { if (result.Text == null || !BarScannerVisible) { return; } var qrMode = JsonConvert.DeserializeObject <Models.QR>(result.Text); if (qrMode == null) { return; } BarScannerVisible = false; Device.InvokeOnMainThreadAsync(() => { var navigationService = new Services.NavigationService(); navigationService.GoToGame(qrMode.Id); }); }); }