[Display(Name = "Lanczos (default)")]\r
Lanczos = 0,\r
\r
- // [Display(Name = "Bicubic")]\r
- // Bicubic,\r
-\r
[Display(Name = "Bicubic (OpenCL)")]\r
BicubicCl,\r
}\r
\r
#region Methods\r
\r
- /// <summary>\r
- /// A Stop Method to be implemeneted.\r
- /// </summary>\r
- public virtual void Stop()\r
- {\r
- // Do Nothing\r
- }\r
-\r
/// <summary>\r
/// Save a copy of the log to the users desired location or a default location\r
/// if this feature is enabled in options.\r
/// <summary>\r
/// Kill the process\r
/// </summary>\r
- public override void Stop()\r
+ public void Stop()\r
{\r
try\r
{\r
namespace HandBrake.ApplicationServices.Services.Scan.EventArgs\r
{\r
using System;\r
- using System.Runtime.Serialization;\r
+\r
+ using HandBrake.ApplicationServices.Services.Scan.Model;\r
\r
/// <summary>\r
/// Scan Progress Event Args\r
/// </summary>\r
- [DataContract]\r
public class ScanCompletedEventArgs : EventArgs\r
{\r
/// <summary>\r
/// <param name="errorInformation">\r
/// The error information.\r
/// </param>\r
- public ScanCompletedEventArgs(bool cancelled, Exception exception, string errorInformation)\r
+ /// <param name="scannedSource">\r
+ /// The scanned Source.\r
+ /// </param>\r
+ public ScanCompletedEventArgs(bool cancelled, Exception exception, string errorInformation, Source scannedSource)\r
{\r
this.Successful = !cancelled && exception == null && string.IsNullOrEmpty(errorInformation);\r
this.Cancelled = cancelled;\r
this.Exception = exception;\r
this.ErrorInformation = errorInformation;\r
+ this.ScannedSource = scannedSource;\r
}\r
\r
/// <summary>\r
- /// Gets or sets a value indicating whether Successful.\r
+ /// Gets a value indicating whether Successful.\r
+ /// </summary>\r
+ public bool Successful { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets a value indicating whether Cancelled.\r
/// </summary>\r
- [DataMember]\r
- public bool Successful { get; set; }\r
+ public bool Cancelled { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets a value indicating whether Cancelled.\r
+ /// Gets the Exception.\r
/// </summary>\r
- [DataMember]\r
- public bool Cancelled { get; set; }\r
+ public Exception Exception { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets Exception.\r
+ /// Gets ErrorInformation.\r
/// </summary>\r
- [DataMember]\r
- public Exception Exception { get; set; }\r
+ public string ErrorInformation { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets ErrorInformation.\r
+ /// Gets the scanned source.\r
/// </summary>\r
- [DataMember]\r
- public string ErrorInformation { get; set; }\r
+ public Source ScannedSource { get; private set; }\r
}\r
}\r
/// </summary>\r
bool IsScanning { get; }\r
\r
- /// <summary>\r
- /// Gets the Souce Data.\r
- /// </summary>\r
- Source SouceData { get; }\r
-\r
/// <summary>\r
/// Gets ActivityLog.\r
/// </summary>\r
/// <param name="configuration">\r
/// The configuraiton.\r
/// </param>\r
- void Scan(string sourcePath, int title, Action<bool> postAction, HBConfiguration configuration);\r
+ void Scan(string sourcePath, int title, Action<bool, Source> postAction, HBConfiguration configuration);\r
\r
/// <summary>\r
/// Get a Preview image for the current job and preview number.\r
/// <summary>\r
/// The post scan operation.\r
/// </summary>\r
- private Action<bool> postScanOperation;\r
+ private Action<bool, Source> postScanOperation;\r
\r
#endregion\r
\r
{\r
this.logging = new StringBuilder();\r
this.header = GeneralUtilities.CreateLogHeader();\r
+ this.IsScanning = false;\r
}\r
\r
#region Events\r
/// </summary>\r
public bool IsScanning { get; private set; }\r
\r
- /// <summary>\r
- /// Gets the Souce Data.\r
- /// </summary>\r
- public Source SouceData { get; private set; }\r
-\r
/// <summary>\r
/// Gets ActivityLog.\r
/// </summary>\r
/// <param name="configuraiton">\r
/// The configuraiton.\r
/// </param>\r
- public void Scan(string sourcePath, int title, Action<bool> postAction, HBConfiguration configuraiton)\r
+ public void Scan(string sourcePath, int title, Action<bool, Source> postAction, HBConfiguration configuraiton)\r
{\r
// Try to cleanup any previous scan instances.\r
if (this.instance != null)\r
this.Stop();\r
\r
if (this.ScanCompleted != null)\r
- this.ScanCompleted(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()"));\r
+ this.ScanCompleted(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()", null));\r
}\r
}\r
\r
}\r
\r
// Process into internal structures.\r
+ Source sourceData = null;\r
if (this.instance != null && this.instance.Titles != null)\r
{\r
- this.SouceData = new Source { Titles = ConvertTitles(this.instance.Titles), ScanPath = path };\r
+ sourceData = new Source { Titles = ConvertTitles(this.instance.Titles), ScanPath = path };\r
}\r
\r
this.IsScanning = false;\r
\r
if (this.postScanOperation != null)\r
{\r
- this.postScanOperation(true);\r
+ try\r
+ {\r
+ this.postScanOperation(true, sourceData);\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ Debug.WriteLine(exc);\r
+ }\r
+\r
+ this.postScanOperation = null; // Reset\r
}\r
else\r
{\r
- if (this.ScanCompleted != null) this.ScanCompleted(this, new ScanCompletedEventArgs(false, null, string.Empty));\r
+ if (this.ScanCompleted != null) this.ScanCompleted(this, new ScanCompletedEventArgs(false, null, string.Empty, sourceData));\r
}\r
}\r
\r
/// <param name="titles">\r
/// The titles.\r
/// </param>\r
- /// <param name="featureTitle">\r
- /// The feature Title.\r
- /// </param>\r
/// <returns>\r
/// The convert titles.\r
/// </returns>\r
/// <param name="successful">\r
/// The successful.\r
/// </param>\r
- private void QueueEditAction(bool successful)\r
+ /// <param name="scannedSource">\r
+ /// The scanned Source.\r
+ /// </param>\r
+ private void QueueEditAction(bool successful, Source scannedSource)\r
{\r
/* TODO Fix this. */\r
Execute.OnUIThread(() =>\r
{\r
// Copy all the Scan data into the UI\r
- this.scanService.SouceData.CopyTo(this.ScannedSource);\r
+ scannedSource.CopyTo(this.ScannedSource);\r
this.NotifyOfPropertyChange(() => this.ScannedSource);\r
this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);\r
\r
/// </param>\r
private void ScanCompleted(object sender, ScanCompletedEventArgs e)\r
{\r
- this.scanService.SouceData.CopyTo(this.ScannedSource);\r
+ if (e.ScannedSource != null)\r
+ {\r
+ e.ScannedSource.CopyTo(this.ScannedSource);\r
+ }\r
+ else\r
+ {\r
+ this.ScannedSource = null;\r
+ }\r
+\r
Execute.OnUIThread(() =>\r
{\r
if (e.Successful)\r