I appreciate this is a bit of a general question, but I thought someone might be able to direct me.
I've written a sample application to show my students an example of MVVM . One of the motivations for MVVM is loose coupling and hence easier unit testing.
For my ViewModel, everything is working out so far except for one small detail - Commands.
In my view model constructor, I have the following lines which are dependent on Xamarin.Forms:
In the constructor of the ViewModel
FetchNextSayingCommand = new Command(execute: async () => await DoFetchNextMessageCommand(), canExecute: () => NetworkIsIdle);
DoFetchNextMessageCommand() simply asks the model to fetch a new string from Azure and
NetworkIsIdle is a
bool property that is
false during a network transaction.
When listening for an event from the Model to say the network status has changed:
I think my question reduces down to two fundamentals:
using Xamarin.Forms;from the head of my source)