In my universal app I have a MainViewModel that I share between both the windows and the Phone projects. Depending on what project is run, I would like the MainViewModel to implement a different interface. Lets say these are my two classes and the interface that they both implements:
public class PhotoPhone : IPhotograph
{
//some methods
}
public class PhotoWin : IPhotograph
{
//some methods
}
public interface IPhotograph
{
//some signatures
}
And here is my MainViewModel:
public class MainViewModel : ViewModelBase
{
private IPhotograph _phot;
public MainViewModel(IPhotograph photo)
{
// Depending on what platform is running
//I want the proper implementation
}
}
But how can I make my MainViewModel implement the correct implementation of IPhotograph? I'm thinking that maybe some code should be added to my App.Xaml file. Is this maybe the wrong way to go about this issue? I would like to learn the proper way by following MVVM as far as possible.