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
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
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
\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
this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;\r
}\r
\r
- #region Properties\r
/// <summary>\r
/// Gets or sets TestProperty.\r
/// </summary>\r
}\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
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
Application.Current.Shutdown();\r
}\r
\r
+ #endregion\r
+\r
+\r
#region Event Handlers\r
/// <summary>\r
/// Handle the Scan Status Changed Event.\r