summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-03-07 22:11:11 +0000
committersr55 <[email protected]>2013-03-07 22:11:11 +0000
commit0058e66974b545911342f72078469653384b509d (patch)
tree91ee17656180a2065deb72c33abeb31a88a14ecc /win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
parentabb517d43f2d80b030fed462107bbfa67385673f (diff)
WinGui: Some Threading, Performance and Log window fixes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5308 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs71
1 files changed, 26 insertions, 45 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index 866edb794..555b004f2 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -15,8 +15,6 @@ namespace HandBrake.ApplicationServices.Services.Base
using System.Text;
using System.Text.RegularExpressions;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
@@ -41,11 +39,6 @@ namespace HandBrake.ApplicationServices.Services.Base
private readonly IUserSettingService userSettingService;
/// <summary>
- /// Windows 7 API Pack wrapper
- /// </summary>
- private readonly Win7 windowsSeven = new Win7();
-
- /// <summary>
/// The Log File Header
/// </summary>
private readonly StringBuilder header;
@@ -76,6 +69,8 @@ namespace HandBrake.ApplicationServices.Services.Base
GeneralUtilities.CreateCliLogHeader(
userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
+
+ this.LogIndex = 0;
}
#region Events
@@ -119,24 +114,18 @@ namespace HandBrake.ApplicationServices.Services.Base
}
/// <summary>
- /// Gets LogBuffer.
+ /// Gets the log index.
/// </summary>
- public StringBuilder LogBuffer
- {
- get
- {
- return this.logBuffer;
- }
- }
+ public int LogIndex { get; private set; }
/// <summary>
- /// Gets WindowsSeven.
+ /// Gets LogBuffer.
/// </summary>
- public Win7 WindowsSeven
+ public StringBuilder LogBuffer
{
get
{
- return this.windowsSeven;
+ return this.logBuffer;
}
}
@@ -152,15 +141,11 @@ namespace HandBrake.ApplicationServices.Services.Base
/// </param>
public void InvokeEncodeStatusChanged(EncodeProgressEventArgs e)
{
- Execute.OnUIThread(
- () =>
- {
- EncodeProgessStatus handler = this.EncodeStatusChanged;
- if (handler != null)
- {
- handler(this, e);
- }
- });
+ EncodeProgessStatus handler = this.EncodeStatusChanged;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
}
/// <summary>
@@ -171,15 +156,13 @@ namespace HandBrake.ApplicationServices.Services.Base
/// </param>
public void InvokeEncodeCompleted(EncodeCompletedEventArgs e)
{
- Execute.OnUIThread(
- () =>
- {
- EncodeCompletedStatus handler = this.EncodeCompleted;
- if (handler != null)
- {
- handler(this, e);
- }
- });
+ EncodeCompletedStatus handler = this.EncodeCompleted;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+
+ this.LogIndex = 0; // Reset
}
/// <summary>
@@ -190,14 +173,11 @@ namespace HandBrake.ApplicationServices.Services.Base
/// </param>
public void InvokeEncodeStarted(EventArgs e)
{
- Execute.OnUIThread(() =>
- {
- EventHandler handler = this.EncodeStarted;
- if (handler != null)
- {
- handler(this, e);
- }
- });
+ EventHandler handler = this.EncodeStarted;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
}
#endregion
@@ -261,7 +241,6 @@ namespace HandBrake.ApplicationServices.Services.Base
}
}
-
/// <summary>
/// Pase the CLI status output (from standard output)
/// </summary>
@@ -393,6 +372,8 @@ namespace HandBrake.ApplicationServices.Services.Base
{
try
{
+ this.LogIndex = this.LogIndex + 1;
+
lock (this.LogBuffer)
{
this.LogBuffer.AppendLine(message);