X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=win%2FC%23%2FfrmActivityWindow.cs;h=5f41c799bd50d4fcd7a31ef6d986c90bf888aa7a;hb=a524194964cbed535f17b1b729fec7847539c94e;hp=6b1ffee980df16faf89e0ccc0c556181b5bd8801;hpb=47f16eef804f6abb1519eee64ba7c185c86c37a1;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs index 6b1ffee9..5f41c799 100644 --- a/win/C#/frmActivityWindow.cs +++ b/win/C#/frmActivityWindow.cs @@ -10,7 +10,6 @@ using System.Text; using System.Windows.Forms; using System.IO; using System.Threading; -using Handbrake.EncodeQueue; using Handbrake.Functions; using Microsoft.Win32; @@ -24,11 +23,13 @@ namespace Handbrake private static int _position; private static string _lastMode; private static string _currentMode; - private Thread monitor; - private Boolean kilLThread; + private Thread _monitor; + private Boolean _kilLThread; public frmActivityWindow(string mode) { + _kilLThread = false; + _position = 0; if (mode == "scan") SetScanMode(); else @@ -38,17 +39,15 @@ namespace Handbrake } private void NewActivityWindow_Load(object sender, EventArgs e) { - monitor = new Thread(LogMonitor); - _position = 0; - kilLThread = false; - + _monitor = new Thread(LogMonitor); + try { - monitor.Start(); + _monitor.Start(); } catch (Exception exc) { - MessageBox.Show(exc.ToString()); + MessageBox.Show("Unable to monitor HandBrakes log files. Please report this error. If the problem presists, try rebooting your computer.\n\n Debug Informaton:\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -56,17 +55,13 @@ namespace Handbrake { while (true) { - if (!IsHandleCreated || kilLThread) // break out the thread if the window has been disposed. + if (!IsHandleCreated || _kilLThread) // break out the thread if the window has been disposed. break; // Perform a reset if require. // If we have switched to a different log file, we want to start from the beginning. if (SetLogFile != _lastMode) - { - _position = 0; - ClearWindowText(); - PrintLogHeader(); - } + Reset(); // Perform the window update switch (SetLogFile) @@ -140,7 +135,7 @@ namespace Handbrake } catch (Exception exc) { - appendText.AppendFormat("\nERROR: The Log file could not be read. You may need to restart HandBrake! " + exc); + appendText.AppendFormat("\n The Log file could not be read. You may need to restart HandBrake! " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); _position = 0; ClearWindowText(); } @@ -166,7 +161,7 @@ namespace Handbrake } catch (Exception exc) { - MessageBox.Show("SetWindowText(): Exception: \n" + exc); + MessageBox.Show("Unless you are having problems, you can probably ignore this error. It would not hurt to report this error!\n\nSetWindowText(): Exception: \n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } private void ClearWindowText() @@ -186,10 +181,10 @@ namespace Handbrake } catch (Exception exc) { - MessageBox.Show("ClearWindowText(): Exception: \n" + exc); + MessageBox.Show("Unless you are having problems, you can probably ignore this error. It would not hurt to report this error!\n\nClearWindowText(): Exception: \n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } - public void PrintLogHeader() + private void PrintLogHeader() { try { @@ -217,10 +212,16 @@ namespace Handbrake } catch (Exception exc) { - MessageBox.Show("PrintLogHeader(): Exception: \n" + exc); + MessageBox.Show("Unless you are having problems, you can probably ignore this error. It would not hurt to report this error!\n\nPrintLogHeader(): Exception: \n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } + private void Reset() + { + _position = 0; + ClearWindowText(); + PrintLogHeader(); + } #region Public @@ -231,11 +232,13 @@ namespace Handbrake } public void SetScanMode() { + Reset(); SetLogFile = "last_scan_log.txt"; this.Text = "Activity Window (Scan Log)"; } public void SetEncodeMode() { + Reset(); SetLogFile = "last_encode_log.txt"; this.Text = "Activity Window (Enocde Log)"; } @@ -315,9 +318,9 @@ namespace Handbrake protected override void OnClosing(CancelEventArgs e) { - kilLThread = true; - monitor.Interrupt(); - monitor.Join(); + _kilLThread = true; + _monitor.Interrupt(); + _monitor.Join(); e.Cancel = true; this.Dispose(); base.OnClosing(e);