diff options
author | sr55 <[email protected]> | 2007-07-25 22:16:29 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2007-07-25 22:16:29 +0000 |
commit | 2d9fb029986e17218272e01ae1c629237e5c204d (patch) | |
tree | 0b82ccfb21baedab6975de0e593c174381076d07 /win/C# | |
parent | 293f0c3d36474e6114948e8c186a3bcc44bf4ad3 (diff) |
WinGui:
- User is prevented from trying to launch more than 1 encode process from frmMain.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@737 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r-- | win/C#/frmMain.cs | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index c66cee0b6..f2471baad 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -646,6 +646,7 @@ namespace Handbrake // Encode / Cancel Buttons
// Encode Progress Text Handler
//---------------------------------------------------
+
Functions.CLI process = new Functions.CLI();
private void btn_encode_Click(object sender, EventArgs e)
@@ -675,38 +676,39 @@ namespace Handbrake private void procMonitor(object state)
{
-
- hbProc = process.runCli(this, (string)state, true, true, false, true);
+ // Make sure we are not already encoding and if we are then display an error.
+ if (hbProc != null)
+ {
+ MessageBox.Show("Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+ else
+ {
+ hbProc = process.runCli(this, (string)state, true, true, false, true);
- MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
+ MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- try
- {
- Parsing.Parser encode = new Parsing.Parser(hbProc.StandardError.BaseStream);
- encode.OnEncodeProgress += encode_OnEncodeProgress;
- while (!encode.EndOfStream)
+ try
{
- encode.ReadLine();
+ Parsing.Parser encode = new Parsing.Parser(hbProc.StandardError.BaseStream);
+ encode.OnEncodeProgress += encode_OnEncodeProgress;
+ while (!encode.EndOfStream)
+ {
+ encode.ReadLine();
+ }
+
+ hbProc.WaitForExit();
+ process.closeCLI();
+ hbProc = null;
+ }
+ catch (Exception)
+ {
+ // Do nothing
}
- hbProc.WaitForExit();
- process.closeCLI();
- hbProc = null;
+ MessageBox.Show("The encode process has now ended.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
- catch (Exception)
- {
- // Do Nothing
- }
-
- //TODO: prevent this event from being subscribed more than once
-
-
- MessageBox.Show("The encode process has now ended.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
-
-
-
private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
{
if (this.InvokeRequired)
|