Here is my implementation of this scenario, if it can help:
PCL:
public enum PlateformType
{
Android,
iPhone,
WindowsPhone,
WindowsStore
}
public interface IPlateformInfos
{
PlateformType GetPlateformType();
}
public class CustomAppStart
: MvxNavigatingObject
, IMvxAppStart
{
public void Start(object hint = null)
{
var plateformInfos = Mvx.Resolve<IPlateformInfos>();
var plateformType = plateformInfos.GetPlateformType();
switch (plateformType)
{
default:
ShowViewModel<MenuViewModel>();
break;
case PlateformType.WindowsPhone:
case PlateformType.WindowsStore:
ShowViewModel<FirstViewModel>();
break;
}
}
}
PCL App.cs:
RegisterAppStart(new CustomAppStart());
UI (ex: WindowsPhone):
public class PlateformInfos : IPlateformInfos
{
public PlateformType GetPlateformType()
{
return PlateformType.WindowsPhone;
}
}
UI Setup.cs:
protected override void InitializeFirstChance()
{
Mvx.RegisterSingleton<IPlateformInfos>(new PlateformInfos());
base.InitializeFirstChance();
}
Pretty simple way.
source
share