// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// The MEF Bootstrapper (Not Used)
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Startup
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using Caliburn.Micro;
using HandBrakeWPF.ViewModels.Interfaces;
///
/// The MEF Bootstrapper (Not Used)
///
public class MefBootstrapper : Bootstrapper
{
///
/// The Backing field for the container
///
private CompositionContainer container;
///
/// MEF Configure
///
protected override void Configure()
{
container = new CompositionContainer(
new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)))
);
var batch = new CompositionBatch();
batch.AddExportedValue(new WindowManager());
batch.AddExportedValue(new EventAggregator());
batch.AddExportedValue(container);
container.Compose(batch);
}
///
/// Get an Instance of a service
///
///
/// The service.
///
///
/// The key.
///
///
/// The Service Requested
///
protected override object GetInstance(Type serviceType, string key)
{
string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key;
var exports = container.GetExportedValues