OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / HandBrakeWPF / ViewModels / MainViewModel.cs
index 4b2180d..b39906d 100644 (file)
@@ -6,6 +6,7 @@
 namespace HandBrakeWPF.ViewModels\r
 {\r
     using System;\r
+    using System.Collections.ObjectModel;\r
     using System.Diagnostics;\r
     using System.IO;\r
     using System.Windows;\r
@@ -15,6 +16,8 @@ namespace HandBrakeWPF.ViewModels
     using HandBrake.ApplicationServices.Services;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
 \r
+    using Microsoft.Practices.ServiceLocation;\r
+\r
     /// <summary>\r
     /// HandBrakes Main Window\r
     /// </summary>\r
@@ -33,6 +36,11 @@ namespace HandBrakeWPF.ViewModels
         private readonly IQueueProcessor queueProcessor;\r
 \r
         /// <summary>\r
+        /// The preset service\r
+        /// </summary>\r
+        private readonly IPresetService presetService;\r
+\r
+        /// <summary>\r
         /// HandBrakes Main Window Title\r
         /// </summary>\r
         private string windowName;\r
@@ -49,14 +57,15 @@ namespace HandBrakeWPF.ViewModels
 \r
         #endregion\r
 \r
-        /// <summary>\r
-        /// Initializes a new instance of the <see cref="MainViewModel"/> class.\r
-        /// </summary>\r
-        public MainViewModel()\r
+        #region Properties\r
+\r
+        public MainViewModel(IServiceLocator locator)\r
+            : base(locator)\r
         {\r
-            // Setup Services\r
+            // Setup Services (TODO - Bring Castle back into the project to wire these up for us)\r
             this.scanService = File.Exists("hb.dll") ? (IScan)new LibScan() : new ScanService();\r
             this.queueProcessor = new QueueProcessor(Process.GetProcessesByName("HandBrake").Length);\r
+            this.presetService = new PresetService();\r
 \r
             // Setup Properties\r
             this.WindowTitle = "HandBrake WPF Test Application";\r
@@ -72,7 +81,6 @@ namespace HandBrakeWPF.ViewModels
             this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;\r
         }\r
 \r
-        #region Properties\r
         /// <summary>\r
         /// Gets or sets TestProperty.\r
         /// </summary>\r
@@ -94,6 +102,17 @@ namespace HandBrakeWPF.ViewModels
         }\r
 \r
         /// <summary>\r
+        /// Gets a list of presets\r
+        /// </summary>\r
+        public ObservableCollection<Preset> Presets\r
+        {\r
+            get\r
+            {\r
+                return this.presetService.Presets;\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
         /// Gets or sets The Current Encode Task that the user is building\r
         /// </summary>\r
         public EncodeTask CurrentTask { get; set; }\r
@@ -167,6 +186,14 @@ namespace HandBrakeWPF.ViewModels
             base.Shutdown();\r
         }\r
 \r
+\r
+        #region Menu and Taskbar\r
+        \r
+        public void AboutApplication()\r
+        {\r
+           this.ShowDialog<AboutViewModel>();\r
+        }\r
+        \r
         /// <summary>\r
         /// Shutdown the Application\r
         /// </summary>\r
@@ -175,6 +202,9 @@ namespace HandBrakeWPF.ViewModels
             Application.Current.Shutdown();\r
         }\r
 \r
+        #endregion\r
+\r
+\r
         #region Event Handlers\r
         /// <summary>\r
         /// Handle the Scan Status Changed Event.\r