OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 31 Oct 2010 21:18:29 +0000 (21:18 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 31 Oct 2010 21:18:29 +0000 (21:18 +0000)
- Added an implementation of IWindsorInstaller to the class libraries.

git-svn-id: svn://localhost/HandBrake/trunk@3634 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs [new file with mode: 0644]
win/C#/HandBrake.Framework/HandBrake.Framework.csproj
win/C#/HandBrake.Framework/WindsorInstaller.cs [new file with mode: 0644]
win/C#/Program.cs
win/C#/app.config

index ba0e3a6..31cc44f 100644 (file)
@@ -44,6 +44,9 @@
     <ErrorReport>prompt</ErrorReport>\r
   </PropertyGroup>\r
   <ItemGroup>\r
+    <Reference Include="Castle.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />\r
+    <Reference Include="Castle.MicroKernel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />\r
+    <Reference Include="Castle.Windsor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />\r
     <Reference Include="Growl.Connector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=980c2339411be384, processorArchitecture=MSIL">\r
       <SpecificVersion>False</SpecificVersion>\r
       <HintPath>..\libraries\Growl.Connector.dll</HintPath>\r
     <Compile Include="Services\Interfaces\IScan.cs" />\r
     <Compile Include="Services\Queue.cs" />\r
     <Compile Include="Services\Scan.cs" />\r
+    <Compile Include="WindsorInstaller.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="app.config" />\r
diff --git a/win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs b/win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs
new file mode 100644 (file)
index 0000000..a9bc473
--- /dev/null
@@ -0,0 +1,35 @@
+/*  WindsorInstaller.cs $\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
+\r
+namespace HandBrake.ApplicationServices\r
+{\r
+    using Castle.MicroKernel;\r
+    using Castle.Windsor;\r
+\r
+    using HandBrake.ApplicationServices.Services;\r
+    using HandBrake.ApplicationServices.Services.Interfaces;\r
+\r
+    /// <summary>\r
+    /// This is the Windsor Installer class.\r
+    /// </summary>\r
+    public class WindsorInstaller : IWindsorInstaller\r
+    {\r
+        /// <summary>\r
+        /// Setup the Services for this Library\r
+        /// </summary>\r
+        /// <param name="container">\r
+        /// The container.\r
+        /// </param>\r
+        /// <param name="store">\r
+        /// The store.\r
+        /// </param>\r
+        public void Install(IWindsorContainer container, IConfigurationStore store)\r
+        {\r
+            container.AddComponent<IScan, ScanService>();\r
+            container.AddComponent<IQueue, Queue>();\r
+            container.AddComponent<IEncode, Encode>();\r
+        }\r
+    }\r
+}\r
index ef4246d..18f20ab 100644 (file)
@@ -44,6 +44,9 @@
     <ErrorReport>prompt</ErrorReport>\r
   </PropertyGroup>\r
   <ItemGroup>\r
+    <Reference Include="Castle.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />\r
+    <Reference Include="Castle.MicroKernel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />\r
+    <Reference Include="Castle.Windsor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />\r
     <Reference Include="System" />\r
     <Reference Include="System.Core" />\r
     <Reference Include="System.Drawing" />\r
@@ -85,6 +88,7 @@
     <Compile Include="Views\UpdateInfo.Designer.cs">\r
       <DependentUpon>UpdateInfo.cs</DependentUpon>\r
     </Compile>\r
+    <Compile Include="WindsorInstaller.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <EmbeddedResource Include="Properties\Resources.resx">\r
diff --git a/win/C#/HandBrake.Framework/WindsorInstaller.cs b/win/C#/HandBrake.Framework/WindsorInstaller.cs
new file mode 100644 (file)
index 0000000..0362c7f
--- /dev/null
@@ -0,0 +1,33 @@
+/*  WindsorInstaller.cs $\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
+\r
+namespace HandBrake.Framework\r
+{\r
+    using Castle.MicroKernel;\r
+    using Castle.Windsor;\r
+\r
+    using HandBrake.Framework.Services;\r
+    using HandBrake.Framework.Services.Interfaces;\r
+\r
+    /// <summary>\r
+    /// This is the Windsor Installer class.\r
+    /// </summary>\r
+    public class WindsorInstaller : IWindsorInstaller\r
+    {\r
+        /// <summary>\r
+        /// Setup the Services for this Library\r
+        /// </summary>\r
+        /// <param name="container">\r
+        /// The container.\r
+        /// </param>\r
+        /// <param name="store">\r
+        /// The store.\r
+        /// </param>\r
+        public void Install(IWindsorContainer container, IConfigurationStore store)\r
+        {\r
+            container.AddComponent<IErrorService, ErrorService>();\r
+        }\r
+    }\r
+}\r
index e702265..e81ffd6 100644 (file)
@@ -8,15 +8,17 @@ namespace Handbrake
     using System;\r
     using System.Diagnostics;\r
     using System.IO;\r
+    using System.Reflection;\r
     using System.Windows.Forms;\r
 \r
     using Caliburn.Castle;\r
 \r
-    using Castle.Core.Resource;\r
+    using Castle.MicroKernel;\r
     using Castle.Windsor;\r
-    using Castle.Windsor.Configuration.Interpreters;\r
 \r
     using HandBrake.ApplicationServices;\r
+    using HandBrake.Framework.Services;\r
+    using HandBrake.Framework.Services.Interfaces;\r
 \r
     using Handbrake.Presets;\r
     using Handbrake.Properties;\r
@@ -37,7 +39,12 @@ namespace Handbrake
         [STAThread]\r
         public static void Main(string[] args)\r
         {\r
-            WindsorContainer container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));\r
+            // WindsorContainer container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));\r
+            WindsorContainer container = new WindsorContainer();\r
+            // TODO Would be nice to find a way to do this automatically without having to reference the libraries specifically.\r
+            container.Install(new HandBrake.Framework.WindsorInstaller());\r
+            container.Install(new HandBrake.ApplicationServices.WindsorInstaller());\r
+\r
             ServiceLocator.SetLocatorProvider(() => new WindsorAdapter(container));\r
 \r
             InstanceId = Process.GetProcessesByName("HandBrake").Length;\r
index 313c90e..f3baa7e 100644 (file)
   \r
   <startup />\r
   \r
-  <castle>\r
+  <!--<castle>\r
     <components>\r
       <component id="IErrorService"\r
                  service="HandBrake.Framework.Services.Interfaces.IErrorService, HandBrake.Framework"\r
                  type="HandBrake.Framework.Services.ErrorService, HandBrake.Framework"/>\r
     </components>\r
-  </castle>\r
+  </castle>-->\r
   \r
 </configuration>
\ No newline at end of file