summaryrefslogtreecommitdiffstats
path: root/win/C#/frmMain.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-01-03 21:00:20 +0000
committersr55 <[email protected]>2009-01-03 21:00:20 +0000
commit0b30a330672919074117c371de7d1fee4ff5cbbc (patch)
tree19ce2d17288a8ccc32de9f09b8a39a11329cf9a7 /win/C#/frmMain.cs
parent6a22d98935aced40eef5279465f6cba645d04731 (diff)
WinGui
- Decoupled the Activity window from frmMain and frmQueue. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2056 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmMain.cs')
-rw-r--r--win/C#/frmMain.cs41
1 files changed, 33 insertions, 8 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 8c7be7a62..5110b0b41 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -22,8 +22,9 @@ namespace Handbrake
public partial class frmMain : Form
{
// Objects which may be used by one or more other objects
+ private delegate void UpdateWindowHandler();
Functions.Main hb_common_func = new Functions.Main();
- Functions.Encode cliObj = new Functions.Encode();
+ Functions.Encode encodeHandler = new Functions.Encode();
Queue.Queue encodeQueue = new Queue.Queue();
Presets.PresetsHandler presetHandler = new Presets.PresetsHandler();
Parsing.Title selectedTitle;
@@ -201,7 +202,7 @@ namespace Handbrake
else
file = "hb_encode_log.dat";
- frmActivityWindow dvdInfoWindow = new frmActivityWindow(file, this, queueWindow);
+ frmActivityWindow dvdInfoWindow = new frmActivityWindow(file, encodeHandler);
dvdInfoWindow.Show();
}
private void mnu_options_Click(object sender, EventArgs e)
@@ -504,7 +505,7 @@ namespace Handbrake
{
queueWindow.frmMain_cancelEncode();
if (!queueWindow.isEncoding())
- setEncodeStatus(0);
+ setEncodeFinished();
}
}
else
@@ -532,7 +533,7 @@ namespace Handbrake
queueWindow.frmMain_encode();
- setEncodeStatus(1); // Encode is running, so setup the GUI appropriately
+ setEncodeStarted(); // Encode is running, so setup the GUI appropriately
}
else if (text_source.Text == string.Empty || text_source.Text == "Click 'Source' to continue" || text_destination.Text == string.Empty)
MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
@@ -589,7 +590,7 @@ namespace Handbrake
else
file = "hb_encode_log.dat";
- frmActivityWindow ActivityWindow = new frmActivityWindow(file, this, queueWindow);
+ frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeHandler);
ActivityWindow.Show();
}
#endregion
@@ -1701,10 +1702,16 @@ namespace Handbrake
/// 0 = Encode Finished.
/// </summary>
/// <param name="i">Int</param>
- public void setEncodeStatus(int i)
+ public void setEncodeFinished()
{
- if (i == 0)
+ try
{
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new UpdateWindowHandler(setEncodeFinished));
+ return;
+ }
+
lbl_encode.Text = "Encoding Finished";
btn_start.Text = "Start";
btn_start.ToolTipText = "Start the encoding process";
@@ -1716,15 +1723,33 @@ namespace Handbrake
notifyIcon.BalloonTipText = lbl_encode.Text;
notifyIcon.ShowBalloonTip(500);
}
+
}
- else
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
+ }
+ public void setEncodeStarted()
+ {
+ try
{
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new UpdateWindowHandler(setEncodeStarted));
+ return;
+ }
+
lbl_encode.Visible = true;
lbl_encode.Text = "Encoding in Progress";
btn_start.Text = "Stop";
btn_start.ToolTipText = "Stop the encoding process. \nWarning: This may break your file. Press ctrl-c in the CLI window if you wish it to exit cleanly.";
btn_start.Image = Properties.Resources.stop;
}
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
}
/// <summary>