]> granicus.if.org Git - handbrake/commitdiff
WinGui: Some Threading, Performance and Log window fixes.
authorsr55 <sr55.hb@outlook.com>
Thu, 7 Mar 2013 22:11:11 +0000 (22:11 +0000)
committersr55 <sr55.hb@outlook.com>
Thu, 7 Mar 2013 22:11:11 +0000 (22:11 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5308 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
win/CS/HandBrake.ApplicationServices/Services/Encode.cs
win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
win/CS/HandBrakeWPF/ViewModels/Interfaces/ILogViewModel.cs
win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
win/CS/HandBrakeWPF/Views/LogView.xaml

index 3ddae9b1f3fa25c977d345bf43da8e1dbf283938..31c1d8cec67419f5d7fff61f7875d82ef30f97e1 100644 (file)
@@ -81,6 +81,17 @@ namespace HandBrake.ApplicationServices.Isolation
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets the log index.\r
+        /// </summary>\r
+        public int LogIndex\r
+        {\r
+            get\r
+            {\r
+                return -1;\r
+            }\r
+        }\r
+\r
         /// <summary>\r
         /// Gets a value indicating whether IsEncoding.\r
         /// </summary>\r
index 866edb794bd99c6d5b8e559d72e3693f5dd68d16..555b004f27a996ca0e304ac46934721a7d8ab8f2 100644 (file)
@@ -15,8 +15,6 @@ namespace HandBrake.ApplicationServices.Services.Base
     using System.Text;\r
     using System.Text.RegularExpressions;\r
 \r
-    using Caliburn.Micro;\r
-\r
     using HandBrake.ApplicationServices.EventArgs;\r
     using HandBrake.ApplicationServices.Exceptions;\r
     using HandBrake.ApplicationServices.Model;\r
@@ -40,11 +38,6 @@ namespace HandBrake.ApplicationServices.Services.Base
         /// </summary>\r
         private readonly IUserSettingService userSettingService;\r
 \r
-        /// <summary>\r
-        /// Windows 7 API Pack wrapper\r
-        /// </summary>\r
-        private readonly Win7 windowsSeven = new Win7();\r
-\r
         /// <summary>\r
         /// The Log File Header\r
         /// </summary>\r
@@ -76,6 +69,8 @@ namespace HandBrake.ApplicationServices.Services.Base
                 GeneralUtilities.CreateCliLogHeader(\r
                     userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),\r
                     userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));\r
+\r
+            this.LogIndex = 0;\r
         }\r
 \r
         #region Events\r
@@ -119,24 +114,18 @@ namespace HandBrake.ApplicationServices.Services.Base
         }\r
 \r
         /// <summary>\r
-        /// Gets LogBuffer.\r
+        /// Gets the log index.\r
         /// </summary>\r
-        public StringBuilder LogBuffer\r
-        {\r
-            get\r
-            {\r
-                return this.logBuffer;\r
-            }\r
-        }\r
+        public int LogIndex { get; private set; }\r
 \r
         /// <summary>\r
-        /// Gets WindowsSeven.\r
+        /// Gets LogBuffer.\r
         /// </summary>\r
-        public Win7 WindowsSeven\r
+        public StringBuilder LogBuffer\r
         {\r
             get\r
             {\r
-                return this.windowsSeven;\r
+                return this.logBuffer;\r
             }\r
         }\r
 \r
@@ -152,15 +141,11 @@ namespace HandBrake.ApplicationServices.Services.Base
         /// </param>\r
         public void InvokeEncodeStatusChanged(EncodeProgressEventArgs e)\r
         {\r
-            Execute.OnUIThread(\r
-                () =>\r
-                {\r
-                    EncodeProgessStatus handler = this.EncodeStatusChanged;\r
-                    if (handler != null)\r
-                    {\r
-                        handler(this, e);\r
-                    }\r
-                });\r
+            EncodeProgessStatus handler = this.EncodeStatusChanged;\r
+            if (handler != null)\r
+            {\r
+                handler(this, e);\r
+            }\r
         }\r
 \r
         /// <summary>\r
@@ -171,15 +156,13 @@ namespace HandBrake.ApplicationServices.Services.Base
         /// </param>\r
         public void InvokeEncodeCompleted(EncodeCompletedEventArgs e)\r
         {\r
-            Execute.OnUIThread(\r
-                () =>\r
-                {\r
-                    EncodeCompletedStatus handler = this.EncodeCompleted;\r
-                    if (handler != null)\r
-                    {\r
-                        handler(this, e);\r
-                    }\r
-                });\r
+            EncodeCompletedStatus handler = this.EncodeCompleted;\r
+            if (handler != null)\r
+            {\r
+                handler(this, e);\r
+            }\r
+\r
+            this.LogIndex = 0; // Reset\r
         }\r
 \r
         /// <summary>\r
@@ -190,14 +173,11 @@ namespace HandBrake.ApplicationServices.Services.Base
         /// </param>\r
         public void InvokeEncodeStarted(EventArgs e)\r
         {\r
-            Execute.OnUIThread(() =>\r
-                {\r
-                    EventHandler handler = this.EncodeStarted;\r
-                    if (handler != null)\r
-                    {\r
-                        handler(this, e);\r
-                    }\r
-                });\r
+            EventHandler handler = this.EncodeStarted;\r
+            if (handler != null)\r
+            {\r
+                handler(this, e);\r
+            }\r
         }\r
 \r
         #endregion\r
@@ -261,7 +241,6 @@ namespace HandBrake.ApplicationServices.Services.Base
             }\r
         }\r
 \r
-\r
         /// <summary>\r
         /// Pase the CLI status output (from standard output)\r
         /// </summary>\r
@@ -393,6 +372,8 @@ namespace HandBrake.ApplicationServices.Services.Base
             {\r
                 try\r
                 {\r
+                    this.LogIndex = this.LogIndex + 1;\r
+\r
                     lock (this.LogBuffer)\r
                     {\r
                         this.LogBuffer.AppendLine(message);\r
index 5770670505a5f94f11abed3cb80d4bf771a0c318..b4f57252158e390be3cf545b4948775c8e7d23c0 100644 (file)
@@ -11,7 +11,6 @@ namespace HandBrake.ApplicationServices.Services
 {\r
     using System;\r
     using System.Diagnostics;\r
-    using System.Globalization;\r
     using System.IO;\r
     using System.Windows.Forms;\r
 \r
@@ -66,7 +65,7 @@ namespace HandBrake.ApplicationServices.Services
         public Encode(IUserSettingService userSettingService)\r
             : base(userSettingService)\r
         {\r
-            this.userSettingService = userSettingService;  \r
+            this.userSettingService = userSettingService;\r
         }\r
 \r
         #region Properties\r
@@ -135,7 +134,7 @@ namespace HandBrake.ApplicationServices.Services
                                        userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),\r
                                        userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),\r
                                        userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))\r
-                                   : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task), \r
+                                   : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task),\r
                                    userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),\r
                                    userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),\r
                                    userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));\r
@@ -263,21 +262,16 @@ namespace HandBrake.ApplicationServices.Services
             }\r
 \r
             Execute.OnUIThread(() =>\r
+            {\r
+                if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))\r
                 {\r
-                    if (this.WindowsSeven.IsWindowsSeven)\r
-                    {\r
-                        this.WindowsSeven.SetTaskBarProgressToNoProgress();\r
-                    }\r
-\r
-                    if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))\r
-                    {\r
-                        Win32.AllowSleep();\r
-                    }\r
+                    Win32.AllowSleep();\r
+                }\r
+            });\r
 \r
-                    this.currentTask.Status = QueueItemStatus.Completed;\r
-                    this.IsEncoding = false;\r
-                    this.InvokeEncodeCompleted(new EncodeCompletedEventArgs(true, null, string.Empty));\r
-                });\r
+            this.currentTask.Status = QueueItemStatus.Completed;\r
+            this.IsEncoding = false;\r
+            this.InvokeEncodeCompleted(new EncodeCompletedEventArgs(true, null, string.Empty));\r
         }\r
 \r
         /// <summary>\r
@@ -296,14 +290,14 @@ namespace HandBrake.ApplicationServices.Services
         {\r
             if (!String.IsNullOrEmpty(e.Data))\r
             {\r
-                if (initShutdown && this.LogBuffer.Length < 25000000) \r
+                if (initShutdown && this.LogBuffer.Length < 25000000)\r
                 {\r
                     initShutdown = false; // Reset this flag.\r
                 }\r
 \r
                 if (this.LogBuffer.Length > 25000000 && !initShutdown) // Approx 23.8MB and make sure it's only printed once\r
                 {\r
-                    this.ProcessLogMessage("ERROR: Initiating automatic shutdown of encode process. The size of the log file inidcates that there is an error! ");\r
+                    this.ProcessLogMessage("ERROR: Initiating automatic shutdown of encode process. The size of the log file indicates that there is an error! ");\r
                     initShutdown = true;\r
                     this.Stop();\r
                 }\r
@@ -328,28 +322,14 @@ namespace HandBrake.ApplicationServices.Services
                 EncodeProgressEventArgs eventArgs = this.ReadEncodeStatus(e.Data, this.startTime);\r
                 if (eventArgs != null)\r
                 {\r
-                    Execute.OnUIThread(\r
-                        () =>\r
-                            {\r
-                                if (!this.IsEncoding)\r
-                                {\r
-                                    // We can get events out of order since the CLI progress is monitored on a background thread.\r
-                                    // So make sure we don't send a status update after an encode complete event.\r
-                                    return;\r
-                                }\r
-\r
-                                this.InvokeEncodeStatusChanged(eventArgs);\r
-\r
-                                if (this.WindowsSeven.IsWindowsSeven)\r
-                                {\r
-                                    int percent;\r
-                                    int.TryParse(\r
-                                        Math.Round(eventArgs.PercentComplete).ToString(CultureInfo.InvariantCulture),\r
-                                        out percent);\r
-\r
-                                    this.WindowsSeven.SetTaskBarProgress(percent);\r
-                                }\r
-                            });\r
+                    if (!this.IsEncoding)\r
+                    {\r
+                        // We can get events out of order since the CLI progress is monitored on a background thread.\r
+                        // So make sure we don't send a status update after an encode complete event.\r
+                        return;\r
+                    }\r
+\r
+                    this.InvokeEncodeStatusChanged(eventArgs);\r
                 }\r
             }\r
         }\r
index 915d667881f22ebfff7801f80d89b754003c7a1d..fbb59ec2b8c2f83967d86ae0a3348b027f14081f 100644 (file)
@@ -66,6 +66,11 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
         /// </summary>\r
         string ActivityLog { get; }\r
 \r
+        /// <summary>\r
+        /// Gets the log index. The current log row counter.\r
+        /// </summary>\r
+        int LogIndex { get; }\r
+\r
         /// <summary>\r
         /// Start with a LibHb EncodeJob Object\r
         /// </summary>\r
index 0d1998a5994eea1050c8b43b2e89605aebc98f34..33453dad877d6e4f9b6cbc541632a42fa49bd78a 100644 (file)
@@ -254,14 +254,6 @@ namespace HandBrake.ApplicationServices.Services
             };\r
 \r
             this.InvokeEncodeStatusChanged(args);\r
-\r
-            if (this.WindowsSeven.IsWindowsSeven)\r
-            {\r
-                int percent;\r
-                int.TryParse(Math.Round(e.FractionComplete).ToString(CultureInfo.InvariantCulture), out percent);\r
-\r
-                this.WindowsSeven.SetTaskBarProgress(percent);\r
-            }\r
         }\r
 \r
         /// <summary>\r
@@ -282,11 +274,6 @@ namespace HandBrake.ApplicationServices.Services
                     ? new EncodeCompletedEventArgs(false, null, string.Empty)\r
                     : new EncodeCompletedEventArgs(true, null, string.Empty));\r
 \r
-            if (this.WindowsSeven.IsWindowsSeven)\r
-            {\r
-                this.WindowsSeven.SetTaskBarProgressToNoProgress();\r
-            }\r
-\r
             if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.PreventSleep))\r
             {\r
                 Win32.AllowSleep();\r
index 8f424b65a7dda314eef98524c1c0368496c5a6f0..2dd1814ee0eae6cb5c004c66d46825ffd9226962 100644 (file)
@@ -126,6 +126,17 @@ namespace HandBrakeWPF.Services
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets the log index.\r
+        /// </summary>\r
+        public int LogIndex\r
+        {\r
+            get\r
+            {\r
+                return this.encodeService.LogIndex;\r
+            }\r
+        }\r
+\r
         /// <summary>\r
         /// Gets a value indicating whether IsEncoding.\r
         /// </summary>\r
index 6aa1020d4f982a8f76310ed70c07cde45dc0ed98..6c7a7a2c8ad121d0fbf58f99977e1dd78769c1f8 100644 (file)
@@ -14,5 +14,9 @@ namespace HandBrakeWPF.ViewModels.Interfaces
     /// </summary>\r
     public interface ILogViewModel\r
     {\r
+        /// <summary>\r
+        /// Gets or sets the selected tab.\r
+        /// </summary>\r
+        int SelectedTab { get; set; }\r
     }\r
 }
\ No newline at end of file
index 5bf95d22f33761fd2a95ad471df3a1fc25fa2994..ad76a56b273440b12cd415f1ad8e649f9ab81581 100644 (file)
@@ -10,7 +10,6 @@
 namespace HandBrakeWPF.ViewModels\r
 {\r
     using System;\r
-    using System.Collections.Generic;\r
     using System.Diagnostics;\r
     using System.Windows;\r
 \r
@@ -36,6 +35,16 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         private readonly IScanServiceWrapper scanService;\r
 \r
+        /// <summary>\r
+        /// The selected tab.\r
+        /// </summary>\r
+        private int selectedTab;\r
+\r
+        /// <summary>\r
+        /// The encode log index.\r
+        /// </summary>\r
+        private int encodeLogIndex;\r
+\r
         #endregion\r
 \r
         /// <summary>\r
@@ -52,12 +61,24 @@ namespace HandBrakeWPF.ViewModels
             this.encodeService = encodeService;\r
             this.scanService = scanService;\r
             this.Title = "Log Viewer";\r
+            this.encodeLogIndex = 0;\r
         }\r
 \r
         /// <summary>\r
         /// Gets or sets the selected tab.\r
         /// </summary>\r
-        public int SelectedTab { get; set; }\r
+        public int SelectedTab\r
+        {\r
+            get\r
+            {\r
+                return this.selectedTab;\r
+            }\r
+            set\r
+            {\r
+                this.selectedTab = value;\r
+                this.NotifyOfPropertyChange(() => this.SelectedTab);\r
+            }\r
+        }\r
 \r
         /// <summary>\r
         /// Gets Log.\r
@@ -97,7 +118,7 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         public void CopyLog()\r
         {\r
-            Clipboard.SetDataObject(this.SelectedTab == 0 ? this.ScanLog : this.EncodeLog, true);\r
+            Clipboard.SetDataObject(this.SelectedTab == 1 ? this.ScanLog : this.EncodeLog, true);\r
         }\r
 \r
         /// <summary>\r
@@ -109,6 +130,8 @@ namespace HandBrakeWPF.ViewModels
             this.encodeService.EncodeCompleted += EncodeServiceEncodeCompleted;\r
             this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;\r
             this.scanService.ScanStatusChanged += this.ScanServiceScanStatusChanged;\r
+            this.scanService.ScanStared += this.scanService_ScanStared;\r
+            this.encodeService.EncodeStarted += this.encodeService_EncodeStarted;\r
             base.OnActivate();\r
 \r
             this.NotifyOfPropertyChange(() => this.ScanLog);\r
@@ -140,7 +163,12 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         private void EncodeServiceEncodeStatusChanged(object sender, EncodeProgressEventArgs e)\r
         {\r
-            this.NotifyOfPropertyChange(() => this.EncodeLog);\r
+            if (encodeLogIndex != this.encodeService.LogIndex || this.encodeService.LogIndex == -1)\r
+            {\r
+                this.NotifyOfPropertyChange(() => this.EncodeLog);\r
+            }\r
+\r
+            encodeLogIndex = this.encodeService.LogIndex;\r
         }\r
 \r
         /// <summary>\r
@@ -155,6 +183,8 @@ namespace HandBrakeWPF.ViewModels
             this.encodeService.EncodeCompleted -= EncodeServiceEncodeCompleted;\r
             this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;\r
             this.scanService.ScanStatusChanged -= this.ScanServiceScanStatusChanged;\r
+            this.scanService.ScanStared -= this.scanService_ScanStared;\r
+            this.encodeService.EncodeStarted -= this.encodeService_EncodeStarted;\r
 \r
             base.OnDeactivate(close);\r
         }\r
@@ -186,5 +216,33 @@ namespace HandBrakeWPF.ViewModels
         {\r
             this.NotifyOfPropertyChange(() => this.EncodeLog);\r
         }\r
+\r
+        /// <summary>\r
+        /// The encode service encode started.\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void encodeService_EncodeStarted(object sender, EventArgs e)\r
+        {\r
+            this.SelectedTab = 0;\r
+        }\r
+\r
+        /// <summary>\r
+        /// The scan service scan stared.\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void scanService_ScanStared(object sender, EventArgs e)\r
+        {\r
+            this.SelectedTab = 1;\r
+        }\r
     }\r
 }
\ No newline at end of file
index c837627c484b0f959532d2907beb47531d9d2abd..8f643a74bae5b17e7798e307939493792d4f4203 100644 (file)
@@ -94,6 +94,11 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         private readonly IEncodeServiceWrapper encodeService;\r
 \r
+        /// <summary>\r
+        /// Windows 7 API Pack wrapper\r
+        /// </summary>\r
+        private readonly Win7 windowsSeven = new Win7();\r
+\r
         /// <summary>\r
         /// HandBrakes Main Window Title\r
         /// </summary>\r
@@ -163,6 +168,11 @@ namespace HandBrakeWPF.ViewModels
         /// The Source Menu Backing Field\r
         /// </summary>\r
         private IEnumerable<SourceMenuItem> sourceMenu;\r
+\r
+        /// <summary>\r
+        /// The last percentage complete value.\r
+        /// </summary>\r
+        private int lastEncodePercentage;\r
         #endregion\r
 \r
         /// <summary>\r
@@ -956,11 +966,15 @@ namespace HandBrakeWPF.ViewModels
 \r
             if (window != null)\r
             {\r
+                ILogViewModel logvm = (ILogViewModel)window.DataContext;\r
+                logvm.SelectedTab = this.IsEncoding ? 0 : 1;\r
                 window.Activate();\r
             }\r
             else\r
             {\r
-                this.WindowManager.ShowWindow(IoC.Get<ILogViewModel>());\r
+                ILogViewModel logvm = IoC.Get<ILogViewModel>();\r
+                logvm.SelectedTab = this.IsEncoding ? 0 : 1;\r
+                this.WindowManager.ShowWindow(logvm);\r
             }\r
         }\r
 \r
@@ -1782,6 +1796,12 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         private void EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)\r
         {\r
+            int percent;\r
+            int.TryParse(\r
+                Math.Round(e.PercentComplete).ToString(CultureInfo.InvariantCulture),\r
+                out percent);\r
+\r
+\r
             Execute.OnUIThread(\r
                 () =>\r
                 {\r
@@ -1796,6 +1816,13 @@ namespace HandBrakeWPF.ViewModels
                                 e.EstimatedTimeLeft,\r
                                 e.ElapsedTime,\r
                                 this.queueProcessor.Count);\r
+\r
+                        if (lastEncodePercentage != percent && this.windowsSeven.IsWindowsSeven)\r
+                        {\r
+                            this.windowsSeven.SetTaskBarProgress(percent);\r
+                        }\r
+\r
+                        lastEncodePercentage = percent;\r
                     }\r
                 });\r
         }\r
@@ -1837,6 +1864,11 @@ namespace HandBrakeWPF.ViewModels
                 {\r
                     this.ProgramStatusLabel = "Queue Finished";\r
                     this.IsEncoding = false;\r
+\r
+                    if (this.windowsSeven.IsWindowsSeven)\r
+                    {\r
+                        this.windowsSeven.SetTaskBarProgressToNoProgress();\r
+                    }\r
                 });\r
         }\r
 \r
index 4f344db08057e45b29ef3ea729c43661f1d9620f..79532b9ee050a6d70c6f56945c9b39dd87489838 100644 (file)
@@ -101,7 +101,7 @@ namespace HandBrakeWPF.ViewModels
             this.errorService = errorService;\r
             this.Title = "Queue";\r
             this.JobsPending = "No encodes pending";\r
-            this.JobStatus = "There are no jobs currently encoding";  \r
+            this.JobStatus = "There are no jobs currently encoding";\r
         }\r
 \r
         #endregion\r
@@ -263,9 +263,9 @@ namespace HandBrakeWPF.ViewModels
             {\r
                 MessageBoxResult result =\r
                     this.errorService.ShowMessageBox(\r
-                        "This encode is currently in progress. If you delete it, the encode will be stoped. Are you sure you wish to proceed?", \r
-                        "Warning", \r
-                        MessageBoxButton.YesNo, \r
+                        "This encode is currently in progress. If you delete it, the encode will be stoped. Are you sure you wish to proceed?",\r
+                        "Warning",\r
+                        MessageBoxButton.YesNo,\r
                         MessageBoxImage.Question);\r
 \r
                 if (result == MessageBoxResult.Yes)\r
@@ -330,7 +330,7 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         public void Import()\r
         {\r
-            VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq", CheckFileExists = true  };\r
+            VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq", CheckFileExists = true };\r
             dialog.ShowDialog();\r
 \r
             this.queueProcessor.RestoreQueue(dialog.FileName);\r
@@ -374,7 +374,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             this.Load();\r
 \r
-            this.WhenDoneAction = this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.WhenCompleteAction);    \r
+            this.WhenDoneAction = this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.WhenCompleteAction);\r
 \r
             this.queueProcessor.JobProcessingStarted += this.queueProcessor_JobProcessingStarted;\r
             this.queueProcessor.QueueCompleted += this.queueProcessor_QueueCompleted;\r
@@ -414,19 +414,23 @@ namespace HandBrakeWPF.ViewModels
         private void EncodeService_EncodeStatusChanged(\r
             object sender, EncodeProgressEventArgs e)\r
         {\r
-            if (this.IsEncoding)\r
+            Caliburn.Micro.Execute.OnUIThread(() =>\r
             {\r
-                this.JobStatus =\r
-                    string.Format(\r
-                        "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}",\r
-                        e.Task,\r
-                        e.TaskCount,\r
-                        e.PercentComplete,\r
-                        e.CurrentFrameRate,\r
-                        e.AverageFrameRate,\r
-                        e.EstimatedTimeLeft,\r
-                        e.ElapsedTime);\r
-            }\r
+                if (this.IsEncoding)\r
+                {\r
+                    this.JobStatus =\r
+                        string.Format(\r
+                            "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}",\r
+                            e.Task,\r
+                            e.TaskCount,\r
+                            e.PercentComplete,\r
+                            e.CurrentFrameRate,\r
+                            e.AverageFrameRate,\r
+                            e.EstimatedTimeLeft,\r
+                            e.ElapsedTime);\r
+                }\r
+\r
+            });\r
         }\r
 \r
         /// <summary>\r
index 94e5989ba1030036d71436943051a269bc98f6d5..f8b2c93278f3ea76e8d71272e4102c024a76606e 100644 (file)
             </ToolBar>\r
 \r
             <TabControl Grid.Row="1" SelectedIndex="{Binding SelectedTab}">\r
-                <TabItem Header="Scan Log">\r
+                <TabItem Header="Encode Log">\r
                     <TextBox Grid.Row="1"\r
                      AcceptsReturn="True"\r
                      IsReadOnly="True"\r
                      ScrollViewer.VerticalScrollBarVisibility="Visible"\r
-                     Text="{Binding ScanLog, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"\r
+                     Text="{Binding EncodeLog, Mode=OneWay,  UpdateSourceTrigger=PropertyChanged}"\r
                      TextWrapping="Wrap" />\r
                 </TabItem>\r
-\r
-                <TabItem Header="Encode Log">\r
+                \r
+                <TabItem Header="Scan Log">\r
                     <TextBox Grid.Row="1"\r
                      AcceptsReturn="True"\r
                      IsReadOnly="True"\r
                      ScrollViewer.VerticalScrollBarVisibility="Visible"\r
-                     Text="{Binding EncodeLog, Mode=OneWay,  UpdateSourceTrigger=PropertyChanged}"\r
+                     Text="{Binding ScanLog, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"\r
                      TextWrapping="Wrap" />\r
                 </TabItem>\r
 \r