]> granicus.if.org Git - handbrake/commitdiff
WinGui: Misc IScan API tweaks.
authorsr55 <sr55.hb@outlook.com>
Sun, 12 Apr 2015 15:03:25 +0000 (15:03 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 12 Apr 2015 15:03:25 +0000 (15:03 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7087 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Model/VideoScaler.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
win/CS/HandBrake.ApplicationServices/Services/Scan/EventArgs/ScanCompletedEventArgs.cs
win/CS/HandBrake.ApplicationServices/Services/Scan/Interfaces/IScan.cs
win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs

index ded9f06bd5e8e46c9e4c093daa368135f2c4846b..8fd6bcd07a251a789e255fccee90d085ee53fbe7 100644 (file)
@@ -19,9 +19,6 @@ namespace HandBrake.ApplicationServices.Model
         [Display(Name = "Lanczos (default)")]\r
         Lanczos = 0,\r
 \r
-        // [Display(Name = "Bicubic")]\r
-        // Bicubic,\r
-\r
         [Display(Name = "Bicubic (OpenCL)")]\r
         BicubicCl,\r
     }\r
index 227a73f5e60a4cfbe2023fee6b6e1f80b7925a32..9a2a7a84800dbcaf9ca688cdaa7bb148ea51c320 100644 (file)
@@ -174,14 +174,6 @@ namespace HandBrake.ApplicationServices.Services.Encode
 \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
index 3c92f9a6f82171f20f2e62fb07b473e78bb15894..8aac4fcf0835ffba2f5c329d60f50fb954809f8e 100644 (file)
@@ -147,7 +147,7 @@ namespace HandBrake.ApplicationServices.Services.Encode
         /// <summary>\r
         /// Kill the process\r
         /// </summary>\r
-        public override void Stop()\r
+        public void Stop()\r
         {\r
             try\r
             {\r
index 8e54cda12f71e00603d23d6bf692f3b113fb8c41..41c44fb76a7939f429d9b6854661dc375e047ff2 100644 (file)
 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
@@ -30,36 +30,41 @@ namespace HandBrake.ApplicationServices.Services.Scan.EventArgs
         /// <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
index 086a9748714bb0b7d6131dec176546a8c0e073fb..0d4c6b3c2d8f18618c0f110b351713b5bc493fce 100644 (file)
@@ -64,11 +64,6 @@ namespace HandBrake.ApplicationServices.Services.Scan.Interfaces
         /// </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
@@ -90,7 +85,7 @@ namespace HandBrake.ApplicationServices.Services.Scan.Interfaces
         /// <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
index 524042606eb05d470c590076dc23f35552325608..a560493ab61656cbeac808f944f6e4ee1983ea87 100644 (file)
@@ -86,7 +86,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
         /// <summary>\r
         /// The post scan operation.\r
         /// </summary>\r
-        private Action<bool> postScanOperation;\r
+        private Action<bool, Source> postScanOperation;\r
 \r
         #endregion\r
 \r
@@ -97,6 +97,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
         {\r
             this.logging = new StringBuilder();\r
             this.header = GeneralUtilities.CreateLogHeader();\r
+            this.IsScanning = false;\r
         }\r
 \r
         #region Events\r
@@ -125,11 +126,6 @@ namespace HandBrake.ApplicationServices.Services.Scan
         /// </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
@@ -165,7 +161,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
         /// <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
@@ -326,7 +322,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
                 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
@@ -370,20 +366,30 @@ namespace HandBrake.ApplicationServices.Services.Scan
             }\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
@@ -446,9 +452,6 @@ namespace HandBrake.ApplicationServices.Services.Scan
         /// <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
index 2ba9744f6273dd4807d622de4e6b7c92ec135fa7..71d8c6a73d6dc8dc0d3f6120e4c8f6c58f21fd84 100644 (file)
@@ -1811,13 +1811,16 @@ namespace HandBrakeWPF.ViewModels
         /// <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
@@ -1990,7 +1993,15 @@ namespace HandBrakeWPF.ViewModels
         /// </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