/// <summary> /// Initializes the specified service locator. /// </summary> /// <param name="serviceLocator">The service locator.</param> public void Initialize(IServiceLocator serviceLocator) { Argument.IsNotNull("serviceLocator", serviceLocator); serviceLocator.RegisterTypeIfNotYetRegistered <IDataContextSubscriptionService, DataContextSubscriptionService>(); serviceLocator.RegisterTypeIfNotYetRegistered <ICommandManager, CommandManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewLoadManager, ViewLoadManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelWrapperService, ViewModelWrapperService>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewManager, ViewManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelManager, ViewModelManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IAutoCompletionService, AutoCompletionService>(); #if NET || NETCORE serviceLocator.RegisterTypeIfNotYetRegistered <IWrapControlService, WrapControlService>(); #endif ViewModelServiceHelper.RegisterDefaultViewModelServices(serviceLocator); #if !XAMARIN var typeFactory = serviceLocator.ResolveType <ITypeFactory>(); var auditor = typeFactory.CreateInstance <InvalidateCommandManagerOnViewModelInitializationAuditor>(); AuditingManager.RegisterAuditor(auditor); #endif DesignTimeHelper.InitializeDesignTime(); }
/// <summary> /// Initializes the specified service locator. /// </summary> /// <param name="serviceLocator">The service locator.</param> public void Initialize(IServiceLocator serviceLocator) { Argument.IsNotNull(() => serviceLocator); serviceLocator.RegisterTypeIfNotYetRegistered <ICommandManager, CommandManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewLoadManager, ViewLoadManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelWrapperService, ViewModelWrapperService>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewManager, ViewManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelManager, ViewModelManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IAutoCompletionService, AutoCompletionService>(); #if !XAMARIN && !WIN80 serviceLocator.RegisterTypeIfNotYetRegistered <IInteractivityManager, InteractivityManager>(); #endif ViewModelServiceHelper.RegisterDefaultViewModelServices(serviceLocator); // Don't use property, we cannot trust the cached property here yet in Visual Studio if (CatelEnvironment.GetIsInDesignMode()) { foreach (var assembly in AssemblyHelper.GetLoadedAssemblies()) { var attributes = assembly.GetCustomAttributesEx(typeof(DesignTimeCodeAttribute)); foreach (var attribute in attributes) { // No need to do anything } } } }
/// <summary> /// Initializes the module /// </summary> public static void Initialize() { var serviceLocator = ServiceLocator.Default; #if !NET serviceLocator.RegisterTypeIfNotYetRegistered <IFrameworkElementLoadedManager, FrameworkElementLoadedManager>(); #endif serviceLocator.RegisterTypeIfNotYetRegistered <IViewManager, ViewManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelManager, ViewModelManager>(); ViewModelServiceHelper.RegisterDefaultViewModelServices(serviceLocator); }
/// <summary> /// Initializes the specified service locator. /// </summary> /// <param name="serviceLocator">The service locator.</param> public void Initialize(IServiceLocator serviceLocator) { Argument.IsNotNull(() => serviceLocator); #if !NET serviceLocator.RegisterTypeIfNotYetRegistered <IFrameworkElementLoadedManager, FrameworkElementLoadedManager>(); #endif serviceLocator.RegisterTypeIfNotYetRegistered <ICommandManager, CommandManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewManager, ViewManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelManager, ViewModelManager>(); ViewModelServiceHelper.RegisterDefaultViewModelServices(serviceLocator); }
/// <summary> /// Initializes the specified service locator. /// </summary> /// <param name="serviceLocator">The service locator.</param> public void Initialize(IServiceLocator serviceLocator) { Argument.IsNotNull(() => serviceLocator); serviceLocator.RegisterTypeIfNotYetRegistered <IDataContextSubscriptionService, DataContextSubscriptionService>(); serviceLocator.RegisterTypeIfNotYetRegistered <ICommandManager, CommandManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewLoadManager, ViewLoadManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelWrapperService, ViewModelWrapperService>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewManager, ViewManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelManager, ViewModelManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IAutoCompletionService, AutoCompletionService>(); #if !XAMARIN && !WIN80 serviceLocator.RegisterTypeIfNotYetRegistered <IInteractivityManager, InteractivityManager>(); #endif ViewModelServiceHelper.RegisterDefaultViewModelServices(serviceLocator); DesignTimeHelper.InitializeDesignTime(); }
/// <summary> /// Initializes the specified service locator. /// </summary> /// <param name="serviceLocator">The service locator.</param> public void Initialize(IServiceLocator serviceLocator) { Argument.IsNotNull("serviceLocator", serviceLocator); serviceLocator.RegisterTypeIfNotYetRegistered <IDataContextSubscriptionService, DataContextSubscriptionService>(); serviceLocator.RegisterTypeIfNotYetRegistered <ICommandManager, CommandManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewLoadManager, ViewLoadManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelWrapperService, ViewModelWrapperService>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewManager, ViewManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IViewModelManager, ViewModelManager>(); serviceLocator.RegisterTypeIfNotYetRegistered <IAutoCompletionService, AutoCompletionService>(); #if NET serviceLocator.RegisterTypeIfNotYetRegistered <IWrapControlService, WrapControlService>(); #endif ViewModelServiceHelper.RegisterDefaultViewModelServices(serviceLocator); DesignTimeHelper.InitializeDesignTime(); }
/// <summary> /// Registers the default view model services in the default <see cref="ServiceLocator"/>. This call can come in handy when the /// services should be accessed before any view model is created. /// </summary> public static void RegisterDefaultViewModelServices() { ViewModelServiceHelper.RegisterDefaultViewModelServices(ServiceLocator.Default); }
/// <summary> /// Initializes a new instance of the <see cref="BootstrapperBase"/> class. /// </summary> /// <param name="serviceLocator">The service locator.</param> protected BootstrapperBase(IServiceLocator serviceLocator = null) { _serviceLocator = serviceLocator ?? ServiceLocator.Default; ViewModelServiceHelper.RegisterDefaultViewModelServices(_serviceLocator); }