ying-hui.the@windev.co.uk (47) [Avatar] Offline
await navigation.Navigate<CounterViewModel>(new Counter()); // this line.

the intellisence red flags the item: navigation

I tried changing it to: navigationService

But then "new Counter" is red flaged.

Q: What s my deliberate mistake, please?
Jim Bennett (88) [Avatar] Offline
You are correct - it should be navigationService, not navigation. Good spot, I'll update the listing.

Not sure why you get an error around new Counter(). Have you added the using directive:

using Countr.Core.Models;
ying-hui.the@windev.co.uk (47) [Avatar] Offline
problem seems to be that in listing 8.33 CountersViewModel has two parameters for the constructor.

viewModel = new CountersViewModel(mockCountersService.Object, messenger.Object);
Jim Bennett (88) [Avatar] Offline
Can you hover over the red intellisense squiggle and see what the error is?

Does your counterviewmodel derive from MvxViewModel<Counter>?

I really need a lot more information to help than just a line of code that has errors. The error itself would be useful, either from hovering over the squiggle or building and seeing the errors window.
ying-hui.the@windev.co.uk (47) [Avatar] Offline

Listing 8.37

async Task ShowAddNewCounter()
await navigationService.Navigate<CounterViewModel>(new Counter()); // Listing 8.37

The error is:
Severity Code Description Project File Line Suppression State
Error CS1503 Argument 1: cannot convert from 'MxMediControl01.Core.Models.Counter' to 'MvvmCross.Core.ViewModels.IMvxBundle'

Cant figure out what i have done wrong.
ying-hui.the@windev.co.uk (47) [Avatar] Offline
yes it does derive..

public class CounterViewModel : MvxViewModel<Counter>
Jim Bennett (88) [Avatar] Offline
Good spot - it's another error in the listing (but the sample code has it correct).

You need to use:

await navigationService.Navigate<CounterViewModel, Counter>(new Counter());

Note the second generic parameter to the Navigate call, you'll need to add this.

Will get the MEAP updated. Thanks!