diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
11 files changed, 467 insertions, 36 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs index d6e5d5598..c300487e3 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs @@ -42,6 +42,7 @@ namespace HandBrakeWPF.ViewModels : base(windowManager)
{
this.userSettingService = userSettingService;
+ this.Title = "About HandBrake";
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index 8f6919e9d..d4a6f077c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -7,23 +7,106 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
+using System.Windows;
+using HandBrake.ApplicationServices.Model;
+using HandBrake.ApplicationServices.Services.Interfaces;
+using HandBrake.ApplicationServices.Utilities;
+using HandBrakeWPF.Services.Interfaces;
+
namespace HandBrakeWPF.ViewModels
{
+ using System.ComponentModel.Composition;
+ using Interfaces;
using Caliburn.Micro;
/// <summary>
/// The Add Preset View Model
/// </summary>
- public class AddPresetViewModel : ViewModelBase
+ [Export(typeof(IAddPresetViewModel))]
+ public class AddPresetViewModel : ViewModelBase, IAddPresetViewModel
{
/// <summary>
+ /// Backing field for the Preset Service
+ /// </summary>
+ private readonly IPresetService presetService;
+
+ /// <summary>
+ /// Backing field for the error service
+ /// </summary>
+ private readonly IErrorService errorService;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="AddPresetViewModel"/> class.
/// </summary>
/// <param name="windowManager">
/// The window manager.
/// </param>
- public AddPresetViewModel(IWindowManager windowManager) : base(windowManager)
+ /// <param name="presetService">
+ /// The Preset Service
+ /// </param>
+ /// <param name="errorService">
+ /// The Error Service
+ /// </param>
+ public AddPresetViewModel(IWindowManager windowManager, IPresetService presetService, IErrorService errorService) : base(windowManager)
+ {
+ this.presetService = presetService;
+ this.errorService = errorService;
+ this.Title = "Add Preset";
+ this.Preset = new Preset {IsBuildIn = false, IsDefault = false, Category = "User Presets"};
+ }
+
+ /// <summary>
+ /// Gets or sets the Preset
+ /// </summary>
+ public Preset Preset { get; private set; }
+
+ /// <summary>
+ /// Prepare the Preset window to create a Preset Object later.
+ /// </summary>
+ /// <param name="task">
+ /// The Encode Task.
+ /// </param>
+ public void Setup(EncodeTask task)
+ {
+ task.UsesPictureFilters = this.Preset.UsePictureFilters;
+ task.UsesMaxPictureSettings = false; // TODO
+ task.UsesPictureSettings = false; // TODO
+ this.Preset.Task = task;
+ this.Preset.Query = QueryGeneratorUtility.GenerateQuery(task);
+ }
+
+ /// <summary>
+ /// Add a Preset
+ /// </summary>
+ public void Add()
+ {
+ if (string.IsNullOrEmpty(this.Preset.Name))
+ {
+ this.errorService.ShowMessageBox("A Preset must have a Name. Please fill out the Preset Name field.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
+ if (this.presetService.CheckIfPresetExists(this.Preset.Name))
+ {
+ this.errorService.ShowMessageBox("A Preset with this name already exists. Please choose a new name", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
+ bool added = this.presetService.Add(this.Preset);
+ if (!added)
+ {
+ this.errorService.ShowMessageBox("Unable to add preset", "Unknown Error", MessageBoxButton.OK,
+ MessageBoxImage.Error);
+ }
+ else
+ {
+ this.Close();
+ }
+ }
+
+ public void Cancel()
{
+ this.Close();
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAddPresetViewModel.cs new file mode 100644 index 000000000..1d5342e01 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAddPresetViewModel.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IAddPresetViewModel.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The Add Preset View Model Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ using HandBrake.ApplicationServices.Model;
+
+ /// <summary>
+ /// The Add Preset View Model
+ /// </summary>
+ public interface IAddPresetViewModel
+ {
+ /// <summary>
+ /// Prepare the Preset window to create a Preset Object later.
+ /// </summary>
+ /// <param name="task">
+ /// The Encode Task.
+ /// </param>
+ void Setup(EncodeTask task);
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs index 51a2b7a98..a0fa8e36d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs @@ -14,5 +14,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// </summary>
public interface IErrorViewModel
{
+ /// <summary>
+ /// The Error Details
+ /// </summary>
+ string Details { set; }
+
+ /// <summary>
+ /// The Error Message
+ /// </summary>
+ string ErrorMessage { set; }
+
+ /// <summary>
+ /// The Error Solution
+ /// </summary>
+ string Solution { set; }
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPreviewViewModel.cs new file mode 100644 index 000000000..f0a7bb660 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPreviewViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IPreviewViewModel.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The Preview View Model Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Preview View Model Interface
+ /// </summary>
+ public interface IPreviewViewModel
+ {
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs new file mode 100644 index 000000000..3530e84c1 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IQueueViewModel.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The Queue View Model Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Queue View Model Interface
+ /// </summary>
+ public interface IQueueViewModel
+ {
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs index aebdd7e73..83a185276 100644 --- a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs @@ -27,6 +27,7 @@ namespace HandBrakeWPF.ViewModels public LogViewModel(IWindowManager windowManager)
: base(windowManager)
{
+ this.Title = "Log Viewer";
}
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index c1b008613..5a8ecd233 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -7,6 +7,8 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
+using HandBrakeWPF.Services.Interfaces;
+
namespace HandBrakeWPF.ViewModels
{
using System;
@@ -67,6 +69,11 @@ namespace HandBrakeWPF.ViewModels private readonly IPresetService presetService;
/// <summary>
+ /// The Error Service Backing field.
+ /// </summary>
+ private readonly IErrorService errorService;
+
+ /// <summary>
/// HandBrakes Main Window Title
/// </summary>
private string windowName;
@@ -127,14 +134,19 @@ namespace HandBrakeWPF.ViewModels /// <param name="presetService">
/// The preset Service.
/// </param>
+ /// <param name="errorService">
+ /// The Error Service
+ /// </param>
[ImportingConstructor]
- public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService)
+ public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
+ IErrorService errorService)
: base(windowManager)
{
this.userSettingService = userSettingService;
this.scanService = scanService;
this.encodeService = encodeService;
this.presetService = presetService;
+ this.errorService = errorService;
this.queueProcessor = IoC.Get<IQueueProcessor>(); // TODO Instance ID!
// Setup Properties
@@ -174,6 +186,27 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Gets or sets the Program Status Toolbar Label
+ /// This indicates the status of HandBrake
+ /// </summary>
+ public string ProgramStatusLabel
+ {
+ get
+ {
+ return string.IsNullOrEmpty(this.programStatusLabel) ? "Ready" : this.sourceLabel;
+ }
+
+ set
+ {
+ if (!object.Equals(this.programStatusLabel, value))
+ {
+ this.programStatusLabel = value;
+ this.NotifyOfPropertyChange("ProgramStatusLabel");
+ }
+ }
+ }
+
+ /// <summary>
/// Gets a list of presets
/// </summary>
public ObservableCollection<Preset> Presets
@@ -245,27 +278,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets or sets the Program Status Toolbar Label
- /// This indicates the status of HandBrake
- /// </summary>
- public string ProgramStatusLabel
- {
- get
- {
- return string.IsNullOrEmpty(this.programStatusLabel) ? "Ready" : this.sourceLabel;
- }
-
- set
- {
- if (!object.Equals(this.programStatusLabel, value))
- {
- this.programStatusLabel = value;
- this.NotifyOfPropertyChange("ProgramStatusLabel");
- }
- }
- }
-
- /// <summary>
/// Gets RangeMode.
/// </summary>
public IEnumerable<PointToPointMode> RangeMode
@@ -486,7 +498,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenAboutApplication()
{
- this.WindowManager.ShowWindow(new AboutViewModel(this.WindowManager, this.userSettingService));
+ this.WindowManager.ShowWindow(IoC.Get<IAboutViewModel>());
}
/// <summary>
@@ -494,7 +506,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenOptionsWindow()
{
- this.WindowManager.ShowWindow(new OptionsViewModel(this.WindowManager, this.userSettingService));
+ this.WindowManager.ShowWindow(IoC.Get<IOptionsViewModel>());
}
/// <summary>
@@ -502,7 +514,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenLogWindow()
{
- this.WindowManager.ShowWindow(new LogViewModel(this.WindowManager));
+ this.WindowManager.ShowWindow(IoC.Get<ILogViewModel>());
}
/// <summary>
@@ -510,10 +522,18 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenQueueWindow()
{
- this.WindowManager.ShowWindow(new QueueViewModel(this.WindowManager));
+ this.WindowManager.ShowWindow(IoC.Get<IQueueViewModel>());
}
/// <summary>
+ /// Open the Queue Window.
+ /// </summary>
+ public void OpenPreviewWindow()
+ {
+ this.WindowManager.ShowWindow(IoC.Get<IPreviewViewModel>());
+ }
+
+ /// <summary>
/// Launch the Help pages.
/// </summary>
public void LaunchHelp()
@@ -530,6 +550,30 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Add the current task to the queue.
+ /// </summary>
+ public void AddToQueue()
+ {
+ if (this.ScannedSource == null || string.IsNullOrEmpty(this.ScannedSource.ScanPath) || this.ScannedSource.Titles.Count == 0)
+ {
+ this.errorService.ShowMessageBox("You must first scan a source and setup your job before adding to the queue.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
+ QueueTask task = new QueueTask
+ {
+ Task = this.CurrentTask,
+ Query = QueryGeneratorUtility.GenerateQuery(this.CurrentTask)
+ };
+ this.queueProcessor.QueueManager.Add(task);
+
+ if (!this.IsEncoding)
+ {
+ this.ProgramStatusLabel = string.Format("{0} Encodes Pending", this.queueProcessor.QueueManager.Count);
+ }
+ }
+
+ /// <summary>
/// Folder Scan
/// </summary>
public void FolderScan()
@@ -565,22 +609,29 @@ namespace HandBrakeWPF.ViewModels // Santiy Checking.
if (this.ScannedSource == null || this.CurrentTask == null)
{
- throw new GeneralApplicationException("You must first scan a source.", string.Empty, null);
+ this.errorService.ShowMessageBox("You must first scan a source.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
}
if (string.IsNullOrEmpty(this.CurrentTask.Destination))
{
- throw new GeneralApplicationException("The Destination field was empty.", "You must first set a destination for the encoded file.", null);
+ this.errorService.ShowMessageBox("The Destination field was empty.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
}
if (this.queueProcessor.IsProcessing)
{
- throw new GeneralApplicationException("HandBrake is already encoding.", string.Empty, null);
+ this.errorService.ShowMessageBox("HandBrake is already encoding.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
}
if (File.Exists(this.CurrentTask.Destination))
{
- // TODO: File Overwrite warning.
+ MessageBoxResult result = this.errorService.ShowMessageBox("The current file already exists, do you wish to overwrite it?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);
+ if (result == MessageBoxResult.No)
+ {
+ return;
+ }
}
// Create the Queue Task and Start Processing
@@ -647,7 +698,9 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void PresetAdd()
{
- throw new NotImplementedException("Still to do this");
+ IAddPresetViewModel presetViewModel = IoC.Get<IAddPresetViewModel>();
+ presetViewModel.Setup(this.CurrentTask);
+ this.WindowManager.ShowWindow(presetViewModel);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index dd683b7c8..4d11f6786 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -320,6 +320,7 @@ namespace HandBrakeWPF.ViewModels public OptionsViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
: base(windowManager)
{
+ this.Title = "Options";
this.userSettingService = userSettingService;
this.Load();
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs index 16177a55e..e7fd8f098 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs @@ -9,12 +9,13 @@ namespace HandBrakeWPF.ViewModels
{
+ using Interfaces;
using Caliburn.Micro;
/// <summary>
/// The About View Model
/// </summary>
- public class PreviewViewModel : ViewModelBase
+ public class PreviewViewModel : ViewModelBase, IPreviewViewModel
{
/// <summary>
/// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
@@ -24,6 +25,7 @@ namespace HandBrakeWPF.ViewModels /// </param>
public PreviewViewModel(IWindowManager windowManager) : base(windowManager)
{
+ this.Title = "Preview";
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index d294e311b..e651d9830 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -9,21 +9,188 @@ namespace HandBrakeWPF.ViewModels
{
+ using System.Windows;
+ using HandBrake.ApplicationServices.Model;
+ using Services.Interfaces;
+ using System.Collections.ObjectModel;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+ using System.ComponentModel.Composition;
+ using Interfaces;
using Caliburn.Micro;
/// <summary>
/// The Preview View Model
/// </summary>
- public class QueueViewModel : ViewModelBase
+ [Export(typeof(IQueueViewModel))]
+ public class QueueViewModel : ViewModelBase, IQueueViewModel
{
+ #region Private Fields
+ /// <summary>
+ /// Queue Processor Backing field
+ /// </summary>
+ private readonly IQueueProcessor queueProcessor;
+
+ /// <summary>
+ /// The Error Service Backing field
+ /// </summary>
+ private readonly IErrorService errorService;
+
+ /// <summary>
+ /// Jobs pending backing field
+ /// </summary>
+ private string jobsPending;
+
+ /// <summary>
+ /// Job Status Backing field.
+ /// </summary>
+ private string jobStatus;
+
+ /// <summary>
+ /// IsEncoding Backing field
+ /// </summary>
+ private bool isEncoding;
+
+ #endregion
+
/// <summary>
/// Initializes a new instance of the <see cref="QueueViewModel"/> class.
/// </summary>
/// <param name="windowManager">
/// The window manager.
/// </param>
- public QueueViewModel(IWindowManager windowManager) : base(windowManager)
+ /// <param name="queueProcessor">
+ /// The Queue Processor Service
+ /// </param>
+ /// <param name="errorService">
+ /// The Error Service
+ /// </param>
+ public QueueViewModel(IWindowManager windowManager, IQueueProcessor queueProcessor, IErrorService errorService)
+ : base(windowManager)
+ {
+ this.queueProcessor = queueProcessor;
+ this.errorService = errorService;
+ this.Title = "Queue";
+ this.JobsPending = "No encodes pending";
+ this.JobStatus = "There are no jobs currently encoding";
+ }
+
+ public ObservableCollection<QueueTask> QueueJobs
{
+ get { return this.queueProcessor.QueueManager.Queue; }
+ }
+
+ /// <summary>
+ /// Gets or sets IsEncoding.
+ /// </summary>
+ public bool IsEncoding
+ {
+ get
+ {
+ return this.isEncoding;
+ }
+
+ set
+ {
+ this.isEncoding = value;
+ this.NotifyOfPropertyChange("IsEncoding");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets JobStatus.
+ /// </summary>
+ public string JobStatus
+ {
+ get
+ {
+ return this.jobStatus;
+ }
+
+ set
+ {
+ this.jobStatus = value;
+ this.NotifyOfPropertyChange("JobStatus");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets JobsPending.
+ /// </summary>
+ public string JobsPending
+ {
+ get
+ {
+ return this.jobsPending;
+ }
+
+ set
+ {
+ this.jobsPending = value;
+ this.NotifyOfPropertyChange("JobsPending");
+ }
+ }
+
+ /// <summary>
+ /// Start Encode
+ /// </summary>
+ public void StartEncode()
+ {
+ if (this.queueProcessor.QueueManager.Count == 0)
+ {
+ this.errorService.ShowMessageBox("There are no pending jobs.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
+ this.queueProcessor.Start();
+ }
+
+ /// <summary>
+ /// Pause Encode
+ /// </summary>
+ public void PauseEncode()
+ {
+ this.queueProcessor.Pause();
+ }
+
+ /// <summary>
+ /// Remove a Job from the queue
+ /// </summary>
+ /// <param name="task">
+ /// The Job to remove from the queue
+ /// </param>
+ public void RemoveJob(QueueTask task)
+ {
+ if (task.Status == QueueItemStatus.InProgress)
+ {
+ MessageBoxResult result = this.errorService.ShowMessageBox(
+ "This encode is currently in progress. If you delete it, the encode will be stoped. Are you sure you wish to proceed?",
+ "Warning", MessageBoxButton.YesNo, MessageBoxImage.Question);
+
+ if (result == MessageBoxResult.Yes)
+ {
+ this.queueProcessor.QueueManager.Remove(task);
+ }
+ }
+ else
+ {
+ this.queueProcessor.QueueManager.Remove(task);
+ }
+
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ }
+
+ public override void OnLoad()
+ {
+ this.queueProcessor.JobProcessingStarted += queueProcessor_JobProcessingStarted;
+ this.queueProcessor.QueueCompleted += queueProcessor_QueueCompleted;
+ this.queueProcessor.QueuePaused += queueProcessor_QueuePaused;
+ this.queueProcessor.QueueManager.QueueChanged += QueueManager_QueueChanged;
+
+ // Setup the window to the correct state.
+ this.IsEncoding = queueProcessor.EncodeService.IsEncoding;
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+
+ base.OnLoad();
}
/// <summary>
@@ -33,5 +200,51 @@ namespace HandBrakeWPF.ViewModels {
this.TryClose();
}
+
+ /// <summary>
+ /// Override the OnActive to run the Screen Loading code in the view model base.
+ /// </summary>
+ protected override void OnActivate()
+ {
+ this.Load();
+ base.OnActivate();
+ }
+
+ private void queueProcessor_QueuePaused(object sender, System.EventArgs e)
+ {
+ this.JobStatus = "Queue Paused";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ }
+
+ private void queueProcessor_QueueCompleted(object sender, System.EventArgs e)
+ {
+ this.JobStatus = "Queue Completed";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ }
+
+ private void queueProcessor_JobProcessingStarted(object sender, HandBrake.ApplicationServices.EventArgs.QueueProgressEventArgs e)
+ {
+ this.JobStatus = "Queue Started";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ this.queueProcessor.EncodeService.EncodeStatusChanged += EncodeService_EncodeStatusChanged;
+ }
+
+ private void EncodeService_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
+ {
+ this.JobStatus = string.Format(
+ "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
+ e.Task,
+ e.TaskCount,
+ e.PercentComplete,
+ e.CurrentFrameRate,
+ e.AverageFrameRate,
+ e.EstimatedTimeLeft,
+ e.ElapsedTime);
+ }
+
+ private void QueueManager_QueueChanged(object sender, System.EventArgs e)
+ {
+ // TODO
+ }
}
}
|