using System.IO;\r
using System.Windows.Forms;\r
\r
- using Handbrake.Presets;\r
+ using Caliburn.Castle;\r
+\r
+ using Castle.Core.Resource;\r
+ using Castle.Windsor;\r
+ using Castle.Windsor.Configuration.Interpreters;\r
\r
using HandBrake.ApplicationServices;\r
\r
+ using Handbrake.Presets;\r
using Handbrake.Properties;\r
\r
+ using Microsoft.Practices.ServiceLocation;\r
+\r
/// <summary>\r
/// HandBrake Starts Here\r
/// </summary>\r
/// <summary>\r
/// The main entry point for the application.\r
/// </summary>\r
- /// <param name="args">Arguments passed in from the shortcut/executable</param>\r
+ /// <param name="args">\r
+ /// The args.\r
+ /// </param>\r
[STAThread]\r
public static void Main(string[] args)\r
{\r
+ WindsorContainer container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));\r
+ ServiceLocator.SetLocatorProvider(() => new WindsorAdapter(container));\r
+\r
InstanceId = Process.GetProcessesByName("HandBrake").Length;\r
\r
// Handle any unhandled exceptions\r
- AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;\r
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomainUnhandledException);\r
\r
// Attempt to upgrade / keep the users settings between versions\r
if (Settings.Default.UpdateRequired)\r
{\r
Settings.Default.Upgrade();\r
Settings.Default.UpdateRequired = false;\r
+ Functions.Main.SetCliVersionData();\r
}\r
\r
// Make sure we have any pre-requesits before trying to launch\r
/// </summary>\r
/// <param name="sender">The sender</param>\r
/// <param name="e">Unhandled Exception EventArgs </param>\r
- private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)\r
+ private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)\r
{\r
- try\r
- {\r
- frmExceptionWindow exceptionWindow = new frmExceptionWindow();\r
- exceptionWindow.Setup("An Unknown Error has occured.", e.ExceptionObject.ToString());\r
- exceptionWindow.ShowDialog();\r
- }\r
- catch (Exception)\r
- {\r
- MessageBox.Show(\r
- "An Unknown Error has occured. \n\n Exception:" + e.ExceptionObject,\r
- "Unhandled Exception",\r
- MessageBoxButtons.OK,\r
- MessageBoxIcon.Error);\r
- }\r
+ MessageBox.Show(\r
+ "An Unknown Error has occured. \n\n Exception:" + e.ExceptionObject,\r
+ "Unhandled Exception",\r
+ MessageBoxButtons.OK,\r
+ MessageBoxIcon.Error);\r
}\r
\r
public static int InstanceId;\r