From a021bfa036456e40afffb07a89a5d26c343c01d2 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 31 Oct 2010 21:18:29 +0000 Subject: [PATCH] WinGui: - Added an implementation of IWindsorInstaller to the class libraries. git-svn-id: svn://localhost/HandBrake/trunk@3634 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrake.ApplicationServices.csproj | 4 +++ .../WindsorInstaller.cs | 35 ++++++++++++++++++++++ .../HandBrake.Framework/HandBrake.Framework.csproj | 4 +++ win/C#/HandBrake.Framework/WindsorInstaller.cs | 33 ++++++++++++++++++++ win/C#/Program.cs | 13 ++++++-- win/C#/app.config | 4 +-- 6 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs create mode 100644 win/C#/HandBrake.Framework/WindsorInstaller.cs diff --git a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index ba0e3a64..31cc44f7 100644 --- a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -44,6 +44,9 @@ prompt + + + False ..\libraries\Growl.Connector.dll @@ -105,6 +108,7 @@ + diff --git a/win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs b/win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs new file mode 100644 index 00000000..a9bc473a --- /dev/null +++ b/win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs @@ -0,0 +1,35 @@ +/* WindsorInstaller.cs $ + This file is part of the HandBrake source code. + Homepage: . + It may be used under the terms of the GNU General Public License. */ + +namespace HandBrake.ApplicationServices +{ + using Castle.MicroKernel; + using Castle.Windsor; + + using HandBrake.ApplicationServices.Services; + using HandBrake.ApplicationServices.Services.Interfaces; + + /// + /// This is the Windsor Installer class. + /// + public class WindsorInstaller : IWindsorInstaller + { + /// + /// Setup the Services for this Library + /// + /// + /// The container. + /// + /// + /// The store. + /// + public void Install(IWindsorContainer container, IConfigurationStore store) + { + container.AddComponent(); + container.AddComponent(); + container.AddComponent(); + } + } +} diff --git a/win/C#/HandBrake.Framework/HandBrake.Framework.csproj b/win/C#/HandBrake.Framework/HandBrake.Framework.csproj index ef4246d6..18f20ab1 100644 --- a/win/C#/HandBrake.Framework/HandBrake.Framework.csproj +++ b/win/C#/HandBrake.Framework/HandBrake.Framework.csproj @@ -44,6 +44,9 @@ prompt + + + @@ -85,6 +88,7 @@ UpdateInfo.cs + diff --git a/win/C#/HandBrake.Framework/WindsorInstaller.cs b/win/C#/HandBrake.Framework/WindsorInstaller.cs new file mode 100644 index 00000000..0362c7fb --- /dev/null +++ b/win/C#/HandBrake.Framework/WindsorInstaller.cs @@ -0,0 +1,33 @@ +/* WindsorInstaller.cs $ + This file is part of the HandBrake source code. + Homepage: . + It may be used under the terms of the GNU General Public License. */ + +namespace HandBrake.Framework +{ + using Castle.MicroKernel; + using Castle.Windsor; + + using HandBrake.Framework.Services; + using HandBrake.Framework.Services.Interfaces; + + /// + /// This is the Windsor Installer class. + /// + public class WindsorInstaller : IWindsorInstaller + { + /// + /// Setup the Services for this Library + /// + /// + /// The container. + /// + /// + /// The store. + /// + public void Install(IWindsorContainer container, IConfigurationStore store) + { + container.AddComponent(); + } + } +} diff --git a/win/C#/Program.cs b/win/C#/Program.cs index e702265d..e81ffd66 100644 --- a/win/C#/Program.cs +++ b/win/C#/Program.cs @@ -8,15 +8,17 @@ namespace Handbrake using System; using System.Diagnostics; using System.IO; + using System.Reflection; using System.Windows.Forms; using Caliburn.Castle; - using Castle.Core.Resource; + using Castle.MicroKernel; using Castle.Windsor; - using Castle.Windsor.Configuration.Interpreters; using HandBrake.ApplicationServices; + using HandBrake.Framework.Services; + using HandBrake.Framework.Services.Interfaces; using Handbrake.Presets; using Handbrake.Properties; @@ -37,7 +39,12 @@ namespace Handbrake [STAThread] public static void Main(string[] args) { - WindsorContainer container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); + // WindsorContainer container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); + WindsorContainer container = new WindsorContainer(); + // TODO Would be nice to find a way to do this automatically without having to reference the libraries specifically. + container.Install(new HandBrake.Framework.WindsorInstaller()); + container.Install(new HandBrake.ApplicationServices.WindsorInstaller()); + ServiceLocator.SetLocatorProvider(() => new WindsorAdapter(container)); InstanceId = Process.GetProcessesByName("HandBrake").Length; diff --git a/win/C#/app.config b/win/C#/app.config index 313c90e7..f3baa7e7 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -145,12 +145,12 @@ - + \ No newline at end of file -- 2.11.0