コード例 #1
0
 static ViewModelLocator()
 {
     Locator.Register <TrendingMoviesViewModel>();
     Locator.Register <DetailMovieViewModel>();
     Locator.Register <SearchViewModel>();
     Locator.Register <SearchResultViewModel>();
 }
コード例 #2
0
 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);
         }
     }
 }
コード例 #3
0
        /// <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);
                }
            }
        }
コード例 #4
0
 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>();
 }
コード例 #5
0
 private static void RegisterAbstractions(ILocator locator)
 {
     locator.Register<IFactoryMethodFactory>(typeof(DefaultFactoryMethodFactory), true);
 }
コード例 #6
0
        public IServiceRegister Register <TService>(System.Func <IServiceProvider, TService> serviceCreator) where TService : class
        {
            _locator.Register(() => serviceCreator(this));

            return(this);
        }