summaryrefslogtreecommitdiffstats
path: root/win/C#/frmActivityWindow.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/C#/frmActivityWindow.cs')
-rw-r--r--win/C#/frmActivityWindow.cs89
1 files changed, 55 insertions, 34 deletions
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs
index 598851f78..78c7927f4 100644
--- a/win/C#/frmActivityWindow.cs
+++ b/win/C#/frmActivityWindow.cs
@@ -13,6 +13,7 @@ namespace Handbrake
using System.Threading;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using Model;
@@ -26,24 +27,29 @@ namespace Handbrake
/* Private Variables */
/// <summary>
- /// The current position in the log file
+ /// The Encode Object
/// </summary>
- private int position;
+ private readonly IQueue encode;
/// <summary>
- /// A Timer for this window
+ /// The Scan Object
/// </summary>
- private Timer windowTimer;
+ private readonly IScan scan;
/// <summary>
- /// The Encode Object
+ /// The Error service
/// </summary>
- private IQueue encode;
+ private readonly IErrorService errorService = new ErrorService();
/// <summary>
- /// The Scan Object
+ /// The current position in the log file
+ /// </summary>
+ private int position;
+
+ /// <summary>
+ /// A Timer for this window
/// </summary>
- private IScan scan;
+ private Timer windowTimer;
/// <summary>
/// The Type of log that the window is currently dealing with
@@ -111,7 +117,7 @@ namespace Handbrake
{
if (rtf_actLog.InvokeRequired)
{
- IAsyncResult invoked = BeginInvoke(new SetModeCallback(SetMode), new object[] {setMode});
+ IAsyncResult invoked = BeginInvoke(new SetModeCallback(SetMode), new object[] { setMode });
EndInvoke(invoked);
}
else
@@ -120,7 +126,7 @@ namespace Handbrake
this.mode = setMode;
Array values = Enum.GetValues(typeof(ActivityLogMode));
- Properties.Settings.Default.ActivityWindowLastMode = (int) values.GetValue(Convert.ToInt32(setMode));
+ Properties.Settings.Default.ActivityWindowLastMode = (int)values.GetValue(Convert.ToInt32(setMode));
Properties.Settings.Default.Save();
this.Text = mode == ActivityLogMode.Scan
@@ -155,8 +161,15 @@ namespace Handbrake
/// </param>
private void NewActivityWindow_Load(object sender, EventArgs e)
{
- ActivityLogMode activitLogMode = (ActivityLogMode) Enum.ToObject(typeof(ActivityLogMode), Properties.Settings.Default.ActivityWindowLastMode);
- SetMode(activitLogMode);
+ try
+ {
+ ActivityLogMode activitLogMode = (ActivityLogMode)Enum.ToObject(typeof(ActivityLogMode), Properties.Settings.Default.ActivityWindowLastMode);
+ SetMode(activitLogMode);
+ }
+ catch (Exception exc)
+ {
+ errorService.ShowError("Error during load.", exc.ToString());
+ }
}
/// <summary>
@@ -224,36 +237,44 @@ namespace Handbrake
{
StringBuilder appendText = new StringBuilder();
- if (this.mode == ActivityLogMode.Scan)
+ try
{
- if (scan == null || scan.ActivityLog == string.Empty)
+ if (this.mode == ActivityLogMode.Scan)
{
- appendText.AppendFormat("Waiting for the log to be generated ...\n");
- position = 0;
- ClearWindowText();
- return appendText;
- }
+ if (scan == null || scan.ActivityLog == string.Empty)
+ {
+ appendText.AppendFormat("Waiting for the log to be generated ...\n");
+ position = 0;
+ ClearWindowText();
+ return appendText;
+ }
- using (StringReader reader = new StringReader(scan.ActivityLog))
- {
- LogReader(reader, appendText);
+ using (StringReader reader = new StringReader(scan.ActivityLog))
+ {
+ LogReader(reader, appendText);
+ }
}
- }
- else
- {
- if (encode == null || encode.ActivityLog == string.Empty)
+ else
{
- appendText.AppendFormat("Waiting for the log to be generated ...\n");
- position = 0;
- ClearWindowText();
- return appendText;
- }
+ if (encode == null || encode.ActivityLog == string.Empty)
+ {
+ appendText.AppendFormat("Waiting for the log to be generated ...\n");
+ position = 0;
+ ClearWindowText();
+ return appendText;
+ }
- using (StringReader reader = new StringReader(encode.ActivityLog))
- {
- LogReader(reader, appendText);
+ using (StringReader reader = new StringReader(encode.ActivityLog))
+ {
+ LogReader(reader, appendText);
+ }
}
}
+ catch (Exception exc)
+ {
+ errorService.ShowError("GetLog() Error", exc.ToString());
+ }
+
return appendText;
}