Example #1
0
        /// <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();
        }
Example #2
0
        /// <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
                    }
                }
            }
        }
Example #3
0
        /// <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);
        }
Example #4
0
        /// <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);
        }
Example #5
0
        /// <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();
        }
Example #6
0
        /// <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();
        }
Example #7
0
 /// <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);
 }
Example #8
0
        /// <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);
        }