diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/Startup')
-rw-r--r-- | win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs | 44 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Startup/MefBootstrapper.cs | 47 |
2 files changed, 89 insertions, 2 deletions
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs index 02710b161..695e0c7c1 100644 --- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs @@ -1,4 +1,13 @@ -namespace HandBrakeWPF.Startup
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="CastleBootstrapper.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The Castle Bootstrapper
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Startup
{
using System;
using System.Collections.Generic;
@@ -43,21 +52,54 @@ this.windsorContainer.Register(Component.For<IMainViewModel>().ImplementedBy<MainViewModel>().LifeStyle.Is(LifestyleType.Singleton));
}
+ /// <summary>
+ /// Select Assemblies
+ /// </summary>
+ /// <returns>
+ /// A List of Assembly objects
+ /// </returns>
protected override IEnumerable<Assembly> SelectAssemblies()
{
return AppDomain.CurrentDomain.GetAssemblies();
}
+ /// <summary>
+ /// Get an Instance of a service
+ /// </summary>
+ /// <param name="service">
+ /// The service.
+ /// </param>
+ /// <param name="key">
+ /// The key.
+ /// </param>
+ /// <returns>
+ /// The Service Requested
+ /// </returns>
protected override object GetInstance(Type service, string key)
{
return string.IsNullOrWhiteSpace(key) ? this.windsorContainer.Resolve(service) : this.windsorContainer.Resolve(key, new { });
}
+ /// <summary>
+ /// Get all instances of a service
+ /// </summary>
+ /// <param name="service">
+ /// The service.
+ /// </param>
+ /// <returns>
+ /// A collection of instances of the requested service type.
+ /// </returns>
protected override IEnumerable<object> GetAllInstances(Type service)
{
return this.windsorContainer.ResolveAll(service).Cast<object>();
}
+ /// <summary>
+ /// Build Up
+ /// </summary>
+ /// <param name="instance">
+ /// The instance.
+ /// </param>
protected override void BuildUp(object instance)
{
instance.GetType().GetProperties()
diff --git a/win/CS/HandBrakeWPF/Startup/MefBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/MefBootstrapper.cs index c03d4baf9..730081af7 100644 --- a/win/CS/HandBrakeWPF/Startup/MefBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/MefBootstrapper.cs @@ -1,4 +1,13 @@ -namespace HandBrakeWPF.Startup
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="MefBootstrapper.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The MEF Bootstrapper (Not Used)
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Startup
{
using System;
using System.Collections.Generic;
@@ -10,10 +19,19 @@ using HandBrakeWPF.ViewModels.Interfaces;
+ /// <summary>
+ /// The MEF Bootstrapper (Not Used)
+ /// </summary>
public class MefBootstrapper : Bootstrapper<IMainViewModel>
{
+ /// <summary>
+ /// The Backing field for the container
+ /// </summary>
private CompositionContainer container;
+ /// <summary>
+ /// MEF Configure
+ /// </summary>
protected override void Configure()
{
container = new CompositionContainer(
@@ -29,6 +47,18 @@ container.Compose(batch);
}
+ /// <summary>
+ /// Get an Instance of a service
+ /// </summary>
+ /// <param name="serviceType">
+ /// The service.
+ /// </param>
+ /// <param name="key">
+ /// The key.
+ /// </param>
+ /// <returns>
+ /// The Service Requested
+ /// </returns>
protected override object GetInstance(Type serviceType, string key)
{
string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key;
@@ -40,11 +70,26 @@ throw new Exception(string.Format("Could not locate any instances of contract {0}.", contract));
}
+ /// <summary>
+ /// Get all instances of a service
+ /// </summary>
+ /// <param name="serviceType">
+ /// The service.
+ /// </param>
+ /// <returns>
+ /// A collection of instances of the requested service type.
+ /// </returns>
protected override IEnumerable<object> GetAllInstances(Type serviceType)
{
return container.GetExportedValues<object>(AttributedModelServices.GetContractName(serviceType));
}
+ /// <summary>
+ /// Build Up
+ /// </summary>
+ /// <param name="instance">
+ /// The instance.
+ /// </param>
protected override void BuildUp(object instance)
{
container.SatisfyImportsOnce(instance);
|