Skip to content

Instantly share code, notes, and snippets.

@tomwis
Last active October 1, 2017 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomwis/c6d4dc0cc20bbfa9a59b16d15cba9409 to your computer and use it in GitHub Desktop.
Save tomwis/c6d4dc0cc20bbfa9a59b16d15cba9409 to your computer and use it in GitHub Desktop.
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