Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class ViewModelLocator
{
static ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
SimpleIoc.Default.Register<DashboardViewModel>();
SimpleIoc.Default.Register<MonthEditViewModel>();
SimpleIoc.Default.Register<IDbService>(() => new DbService(DependencyService.Get<IFileService>()));
SimpleIoc.Default.Register<INavigationService, NavigationService>();
SimpleIoc.Default.Register<IMonthService, MonthService>();
}
public DashboardViewModel Dashboard => ServiceLocator.Current.GetInstance<DashboardViewModel>();
public MonthEditViewModel MonthEdit => ServiceLocator.Current.GetInstance<MonthEditViewModel>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment