static ViewModelLocator() { Locator.Register <TrendingMoviesViewModel>(); Locator.Register <DetailMovieViewModel>(); Locator.Register <SearchViewModel>(); Locator.Register <SearchResultViewModel>(); }
static void RegisterControllers(Assembly assembly, ILocator <IController> controllerLocator) { foreach (Type type in assembly.GetTypes()) { foreach (var attribute in type.GetCustomAttributes(typeof(ControllerAttribute), true)) { ControllerAttribute controllerAttribute = (ControllerAttribute)attribute; controllerLocator.Register(controllerAttribute.ViewName, type, controllerAttribute.Priority); } } }
/// <summary> /// Scans and register Views from the calling assembly. This should be called from all of /// the assemblies containing Views in the initialization. /// </summary> /// <param name="viewLocator">View locator.</param> public static void ScanViews(ILocator <IView> viewLocator) { Assembly assembly = Assembly.GetCallingAssembly(); foreach (Type type in assembly.GetTypes()) { foreach (var attribute in type.GetCustomAttributes(typeof(ViewAttribute), true)) { ViewAttribute viewAttribute = (ViewAttribute)attribute; viewLocator.Register(viewAttribute.ViewName, type, viewAttribute.Priority); } } }
static ViewModelLocator() { Locator.Register <WelcomeViewModel>(); Locator.Register <LoginViewModel>(); Locator.Register <SettingsViewModel>(); Locator.Register <PregledViewModel>(); Locator.Register <LekarskoUverenjeViewModel>(); Locator.Register <LekarskaUverenjaViewModel>(); Locator.Register <ChangePasswordViewModel>(); Locator.Register <NoviZahtevZaPregledViewModel>(); Locator.Register <RegisterViewModel>(); Locator.Register <PosetaViewModel>(); Locator.Register <PreglediViewModel>(); Locator.Register <PasswordCheckViewModel>(); Locator.Register <EditProfileViewModel>(); Locator.Register <LicniPodaciViewModel>(); }
private static void RegisterAbstractions(ILocator locator) { locator.Register<IFactoryMethodFactory>(typeof(DefaultFactoryMethodFactory), true); }
public IServiceRegister Register <TService>(System.Func <IServiceProvider, TService> serviceCreator) where TService : class { _locator.Register(() => serviceCreator(this)); return(this); }