using HandBrakeWPF.ViewModels.Interfaces;\r
using HandBrakeWPF.Views;\r
\r
+ using Microsoft.Win32;\r
+\r
using Ookii.Dialogs.Wpf;\r
\r
using Image = System.Windows.Controls.Image;\r
this.scanService.ScanStatusChanged += this.ScanStatusChanged;\r
this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;\r
this.queueProcessor.QueueCompleted += this.QueueCompleted;\r
+ this.queueProcessor.QueueChanged += this.QueueChanged;\r
this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;\r
\r
this.Presets = this.presetService.Presets;\r
/// </summary>\r
public bool ShowDebugMenu\r
{\r
- get\r
- {\r
- return this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableDebugFeatures);\r
- }\r
+ get\r
+ {\r
+ return this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableDebugFeatures);\r
+ }\r
}\r
\r
/// <summary>\r
this.scanService.ScanStatusChanged -= this.ScanStatusChanged;\r
\r
this.queueProcessor.QueueCompleted -= this.QueueCompleted;\r
+ this.queueProcessor.QueueChanged -= this.QueueChanged;\r
this.queueProcessor.JobProcessingStarted -= this.QueueProcessorJobProcessingStarted;\r
this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeStatusChanged;\r
}\r
public void ShowCliQuery()\r
{\r
this.errorService.ShowMessageBox(\r
- QueryGeneratorUtility.GenerateQuery(this.CurrentTask, \r
+ QueryGeneratorUtility.GenerateQuery(this.CurrentTask,\r
userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),\r
userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),\r
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav)),\r
public void DebugScanLog()\r
{\r
VistaOpenFileDialog dialog = new VistaOpenFileDialog();\r
- \r
+\r
dialog.ShowDialog();\r
\r
if (File.Exists(dialog.FileName))\r
{\r
this.scanService.DebugScanLog(dialog.FileName);\r
- } \r
+ }\r
}\r
\r
#endregion\r
/// </summary>\r
public void BrowseDestination()\r
{\r
- VistaSaveFileDialog dialog = new VistaSaveFileDialog\r
+ SaveFileDialog saveFileDialog = new SaveFileDialog\r
{\r
Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv",\r
+ CheckPathExists = true,\r
AddExtension = true,\r
- OverwritePrompt = true,\r
DefaultExt = ".mp4",\r
+ OverwritePrompt = true,\r
+ FilterIndex = this.CurrentTask.OutputFormat == OutputFormat.Mkv ? 1 : 0,\r
};\r
\r
if (this.CurrentTask != null && !string.IsNullOrEmpty(this.CurrentTask.Destination))\r
{\r
if (Directory.Exists(Path.GetDirectoryName(this.CurrentTask.Destination)))\r
{\r
- dialog.InitialDirectory = Path.GetDirectoryName(this.CurrentTask.Destination) + "\\";\r
- dialog.FileName = Path.GetFileName(this.CurrentTask.Destination);\r
+ saveFileDialog.InitialDirectory = Path.GetDirectoryName(this.CurrentTask.Destination) + "\\";\r
}\r
+\r
+ saveFileDialog.FileName = Path.GetFileName(this.CurrentTask.Destination);\r
}\r
\r
- dialog.ShowDialog();\r
- this.Destination = dialog.FileName;\r
+ saveFileDialog.ShowDialog();\r
+ this.Destination = saveFileDialog.FileName;\r
\r
// Set the Extension Dropdown. This will also set Mp4/m4v correctly.\r
- if (!string.IsNullOrEmpty(dialog.FileName))\r
+ if (!string.IsNullOrEmpty(saveFileDialog.FileName))\r
{\r
- switch (Path.GetExtension(dialog.FileName))\r
+ switch (Path.GetExtension(saveFileDialog.FileName))\r
{\r
case ".mkv":\r
this.SelectedOutputFormat = OutputFormat.Mkv;\r
\r
this.errorService.ShowMessageBox(\r
"The Preset has now been updated with your current settings.", "Preset Updated", MessageBoxButton.OK, MessageBoxImage.Information);\r
- } \r
+ }\r
}\r
\r
/// <summary>\r
/// </summary>\r
public void PresetExport()\r
{\r
- VistaSaveFileDialog savefiledialog = new VistaSaveFileDialog\r
- { Filter = "plist|*.plist", CheckPathExists = true, AddExtension = true };\r
+ VistaSaveFileDialog savefiledialog = new VistaSaveFileDialog { Filter = "plist|*.plist", CheckPathExists = true, AddExtension = true };\r
if (this.selectedPreset != null)\r
{\r
savefiledialog.ShowDialog();\r
{\r
if (e.Successful)\r
{\r
- this.NotifyOfPropertyChange("ScannedSource");\r
- this.NotifyOfPropertyChange("ScannedSource.Titles");\r
+ this.NotifyOfPropertyChange(() => this.ScannedSource);\r
+ this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);\r
this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle)\r
?? this.ScannedSource.Titles.FirstOrDefault();\r
- this.SetupTabs(); \r
+ this.SetupTabs();\r
}\r
\r
this.ShowStatusWindow = false;\r
if (this.SelectedTitle != null && !string.IsNullOrEmpty(this.SelectedTitle.SourceName))\r
{\r
this.SourceLabel = this.SelectedTitle.SourceName;\r
- } \r
+ }\r
else\r
{\r
this.SourceLabel = this.SourceName;\r
}\r
\r
this.StatusLabel = "Scan Completed";\r
- } \r
+ }\r
else if (!e.Successful && e.Exception == null)\r
{\r
this.SourceLabel = "Scan Cancelled.";\r
this.StatusLabel = "Scan Cancelled.";\r
- } \r
+ }\r
else\r
{\r
this.SourceLabel = "Scan Failed... See Activity Log for details.";\r
- this.StatusLabel = "Scan Failed... See Activity Log for details."; \r
+ this.StatusLabel = "Scan Failed... See Activity Log for details.";\r
}\r
});\r
}\r
});\r
}\r
\r
+ /// <summary>\r
+ /// The queue changed.\r
+ /// </summary>\r
+ /// <param name="sender">\r
+ /// The sender.\r
+ /// </param>\r
+ /// <param name="e">\r
+ /// The EventArgs.\r
+ /// </param>\r
+ private void QueueChanged(object sender, EventArgs e)\r
+ {\r
+ Execute.OnUIThread(\r
+ () =>\r
+ {\r
+ this.ProgramStatusLabel = string.Format("{0} Encodes Pending", this.queueProcessor.Count);\r
+ });\r
+ }\r
+\r
/// <summary>\r
/// The process drive.\r
/// </summary>\r
/// </summary>\r
private void DriveTrayChanged()\r
{\r
- Caliburn.Micro.Execute.OnUIThread(() => this.SourceMenu = this.GenerateSourceMenu()); \r
+ Caliburn.Micro.Execute.OnUIThread(() => this.SourceMenu = this.GenerateSourceMenu());\r
}\r
\r
#endregion\r