/// <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)); }
protected override IEnumerable <object> GetAllInstances(Type service) { return(_container?.GetAllInstances(service)); }
protected override IEnumerable <object> GetAllInstances(Type serviceType) => container.GetAllInstances(serviceType);
private static IEnumerable <object> GetAllInstances(Type serviceType) { return(Container.GetAllInstances(serviceType)); }
public static IEnumerable <object> LocateAll(Type serviceType) { return(Container.GetAllInstances(serviceType)); }
protected new IEnumerable <object> GetAllInstances(Type service) { return(Container.GetAllInstances(service)); }
/// <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)); }
/// <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)); }