/// <summary>
        /// Identify, load and configure all instances of <see cref="IStorageMechanism"/> and <see cref="IStorageHandler"/> 
        /// that are defined in the assembly associated with this bootstrapper.
        /// </summary>
        /// <param name="phoneContainer">The currently configured <see cref="PhoneContainer"/>.</param>
        /// <remarks>
        /// Caliburn Micro will automatically load storage handlers and storage mechanisms from the assemblies configured
        /// in <see cref="AssemblySource.Instance"/> when <see cref="PhoneContainer.RegisterPhoneServices"/> is first invoked.
        /// Since the purpose of this bootstrapper is to allow the delayed loading of assemblies, it makes sense to locate
        /// the storage handlers alongside the view models in the same assembly. 
        /// </remarks>
        private void ConfigureStorageMechanismsAndWorkers(SimpleContainer phoneContainer) {
            var coordinator = (StorageCoordinator) (phoneContainer.GetInstance(typeof (StorageCoordinator), null));
            var assembly = GetType().Assembly;

            phoneContainer.AllTypesOf<IStorageMechanism>(assembly);
            phoneContainer.AllTypesOf<IStorageHandler>(assembly);

            phoneContainer.GetAllInstances(typeof (IStorageMechanism)).
                           Where(m => ReferenceEquals(m.GetType().Assembly, assembly)).
                           Apply(m => coordinator.AddStorageMechanism((IStorageMechanism) m));

            phoneContainer.GetAllInstances(typeof (IStorageHandler)).
                           Where(h => ReferenceEquals(h.GetType().Assembly, assembly)).
                           Apply(h => coordinator.AddStorageHandler((IStorageHandler) h));
        }
Exemplo n.º 2
0
 protected override IEnumerable <object> GetAllInstances(Type service)
 {
     return(_container?.GetAllInstances(service));
 }
Exemplo n.º 3
0
 protected override IEnumerable <object> GetAllInstances(Type serviceType) => container.GetAllInstances(serviceType);
Exemplo n.º 4
0
 private static IEnumerable <object> GetAllInstances(Type serviceType)
 {
     return(Container.GetAllInstances(serviceType));
 }
Exemplo n.º 5
0
 public static IEnumerable <object> LocateAll(Type serviceType)
 {
     return(Container.GetAllInstances(serviceType));
 }
Exemplo n.º 6
0
 protected new IEnumerable <object> GetAllInstances(Type service)
 {
     return(Container.GetAllInstances(service));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Get all the instances from the container for the
 /// given service.  This is usually used to get the views
 /// fro the given a given viewmodel.
 /// </summary>
 /// <param name="service">Service to get from the container.</param>
 /// <returns>List of objects from the container for the given service.</returns>
 protected override System.Collections.Generic.IEnumerable <object> GetAllInstances(Type service)
 {
     return(_container.GetAllInstances(service));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Override the orignal function with our container
 /// </summary>
 /// <param name="service"></param>
 /// <returns></returns>
 protected override IEnumerable <object> GetAllInstances(Type service)
 {
     // return the instance of a type
     return(container.GetAllInstances(service));
 }