summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Startup
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-10-22 21:26:28 +0000
committersr55 <[email protected]>2011-10-22 21:26:28 +0000
commit4e0db6ec1bfa440ef7f142e84ad064affbd64490 (patch)
tree02cb20d37fa5bf10329cf14b1b81b0be8249a498 /win/CS/HandBrakeWPF/Startup
parent16ab8ff2bf50476537c9755b2c1670cc25da80b6 (diff)
WinGui: (WPF) Added backing properties for binding on the options window & some general tidy up of the code/comments.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4310 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Startup')
-rw-r--r--win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs44
-rw-r--r--win/CS/HandBrakeWPF/Startup/MefBootstrapper.cs47
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);