summaryrefslogtreecommitdiffstats
path: root/win/C#/frmQueue.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2007-10-16 21:20:29 +0000
committersr55 <[email protected]>2007-10-16 21:20:29 +0000
commit37f0464f607dc7b905ed34048faf41d01e4aba7c (patch)
tree97dadbe37ab903fa9f40c2cd5b88a2366bfb3d6d /win/C#/frmQueue.cs
parentb3a860c81ef5ec69726da83456d0bcc69259565d (diff)
WinGui:
- Few small enhancements to the queue, including a "stop queue" button git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1031 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmQueue.cs')
-rw-r--r--win/C#/frmQueue.cs85
1 files changed, 68 insertions, 17 deletions
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index 117bb147f..bec77f402 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -21,13 +21,21 @@ namespace Handbrake
}
#region Queue Handling
-
+ Boolean cancel = false;
private void btn_q_encoder_Click(object sender, EventArgs e)
{
+ // Reset some values
+
+ lbl_status.Visible = false;
+ cancel = false;
+
+ // Start the encode
try
{
if (list_queue.Items.Count != 0)
{
+ // Setup or reset some values
+ btn_cancel.Visible = true;
progressBar.Value = 0;
lbl_progressValue.Text = "0 %";
progressBar.Step = 100 / list_queue.Items.Count;
@@ -41,6 +49,12 @@ namespace Handbrake
}
}
+ private void btn_cancel_Click(object sender, EventArgs e)
+ {
+ cancel = true;
+ btn_cancel.Visible = false;
+ MessageBox.Show("No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode Video' when you wish to continue encoding the queue.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
[DllImport("user32.dll")]
public static extern void LockWorkStation();
@@ -54,6 +68,7 @@ namespace Handbrake
while (list_queue.Items.Count != 0)
{
string query = list_queue.Items[0].ToString();
+
updateUIElements();
Functions.CLI process = new Functions.CLI();
@@ -62,9 +77,18 @@ namespace Handbrake
hbProc.WaitForExit();
hbProc.Close();
hbProc.Dispose();
+
+ query = "";
+
+ if (cancel == true)
+ {
+ break;
+ }
+
}
resetQueue();
+
// Do something whent he encode ends.
switch (Properties.Settings.Default.CompletionOption)
@@ -90,8 +114,6 @@ namespace Handbrake
default:
break;
}
-
- MessageBox.Show("Encode Queue Completed!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
catch (Exception exc)
{
@@ -101,28 +123,55 @@ namespace Handbrake
private void updateUIElements()
{
- if (this.InvokeRequired)
+ try
{
- this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
- return;
- }
- this.list_queue.Items.RemoveAt(0);
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
+ return;
+ }
+ this.list_queue.Items.RemoveAt(0);
- progressBar.PerformStep();
- lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
- progressBar.Update();
+ progressBar.PerformStep();
+ lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
+ progressBar.Update();
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
}
private void resetQueue()
{
- if (this.InvokeRequired)
+ try
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new ProgressUpdateHandler(resetQueue));
+ return;
+ }
+
+ if (cancel == true)
+ {
+ lbl_status.Visible = true;
+ lbl_status.Text = "Encode Queue Cancelled!";
+ }
+ else
+ {
+ lbl_status.Visible = true;
+ lbl_status.Text = "Encode Queue Completed!";
+ }
+ btn_cancel.Visible = false;
+
+ lbl_progressValue.Text = "0 %";
+ progressBar.Value = 0;
+ progressBar.Update();
+ }
+ catch (Exception exc)
{
- this.BeginInvoke(new ProgressUpdateHandler(resetQueue));
- return;
+ MessageBox.Show(exc.ToString());
}
- lbl_progressValue.Text = "0 %";
- progressBar.Value = 0;
- progressBar.Update();
}
#endregion
@@ -181,5 +230,7 @@ namespace Handbrake
base.OnClosing(e);
}
+
+
}
} \ No newline at end of file