diff options
author | brianmario <[email protected]> | 2007-07-19 05:13:50 +0000 |
---|---|---|
committer | brianmario <[email protected]> | 2007-07-19 05:13:50 +0000 |
commit | e4adf35f39f2108514495b1e8be3f49b98edb6b9 (patch) | |
tree | 099709921187c04703c22d2ca30a986a38fd5227 /win/C#/frmMain.cs | |
parent | 5a4f0a4e0089f3418df1e09eace439703bad9bb8 (diff) |
WinGui:
updated parsing code events to not be static anymore
added encode parsing to catch encode progress
added OnEncodeProgress event
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@717 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmMain.cs')
-rw-r--r-- | win/C#/frmMain.cs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index e050a403e..b2dba365a 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -598,6 +598,7 @@ namespace Handbrake private void btn_encode_Click(object sender, EventArgs e)
{
String query = "";
+ tempEncodeLbl.Visible = true;
if (QueryEditorText.Text == "")
{
@@ -611,11 +612,31 @@ namespace Handbrake ThreadPool.QueueUserWorkItem(procMonitor, query);
}
+ private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new Parsing.EncodeProgressEventHandler(encode_OnEncodeProgress),
+ new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });
+ return;
+ }
+ tempEncodeLbl.Text = string.Format("Encode Progress: {0}%", PercentComplete);
+ }
+
private void procMonitor(object state)
{
Functions.CLI process = new Functions.CLI();
- hbProc = process.runCli(this, (string)state, false, false, false, false);
- MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
+ hbProc = process.runCli(this, (string)state, true, true, false, true);
+
+ Parsing.Parser encode = new Parsing.Parser(hbProc.StandardError.BaseStream);
+ //TODO: prevent this event from being subscribed more than once
+ encode.OnEncodeProgress += encode_OnEncodeProgress;
+ while (!encode.EndOfStream)
+ {
+ encode.ReadLine();
+ }
+
+ MessageBox.Show("The ncode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
hbProc.WaitForExit();
hbProc.Close();
hbProc.Dispose();
|