We will start by creating the ViewModel class, which will handle what will happen when a user taps one of the buttons. Let's set this up by going through the following steps:
- Create a new class called MainViewModel in the ViewModels folder.
- Add ViewModel as a base class for MainViewModel.
- Create a private field of the IClassifier type and call it classifier.
- Create a constructor that has the IClassifier as a parameter.
- Set the value of the classifier field to the value of the parameter in the constructor, as shown in the following code block:
using System.IO;
using System.Linq;
using System.Windows.Input;
using HotdogOrNot.Models;
using HotdogOrNot.Views;
using Xamarin.Forms;
public class MainViewModel : ViewModel
{
private IClassifier classifier;
public MainViewModel(IClassifier classifier)
{
this.classifier = classifier;
}
}
We will use the Xam.Plugin.Media NuGet package for taking the photo and...