diff options
author | brianmario <[email protected]> | 2007-07-15 21:05:49 +0000 |
---|---|---|
committer | brianmario <[email protected]> | 2007-07-15 21:05:49 +0000 |
commit | e8c438e0573761f14af481d07615072babf94951 (patch) | |
tree | e838061f82cd0b6335c51810e78aaacb3eef341a /win/C#/frmQueue.cs | |
parent | c1b0482386b3d1c8d4dc0b21ac140d0e09ac2ef3 (diff) |
WinGui: added initial CLI call managment class (work in progress)
updated frmQueue window to work properly with cross-thread calls and updating proper UI elements
updated ToString override in Parsing.Title to display leading zeros in duration
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@691 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmQueue.cs')
-rw-r--r-- | win/C#/frmQueue.cs | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 8d9157609..f9f59fee3 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -12,7 +12,7 @@ namespace Handbrake {
public partial class frmQueue : Form
{
- private delegate void ProgressUpdateHandler(int progressSplit);
+ private delegate void ProgressUpdateHandler();
public frmQueue()
{
@@ -66,21 +66,16 @@ namespace Handbrake {
progressBar.Value = 0;
lbl_progressValue.Text = "0 %";
+ progressBar.Step = 100 / list_queue.Items.Count;
progressBar.Update();
ThreadPool.QueueUserWorkItem(startProc);
}
private void startProc(object state)
{
- int listSize = list_queue.Items.Count;
- listSize--;
- int counter = 0;
- int progressSplit = listSize / 100;
-
- while (counter <= listSize)
+ for (int i = 0; i < list_queue.Items.Count; i++)
{
- String query = list_queue.Items[0].ToString();
-
+ string query = list_queue.Items[i] as string;
Process hbProc = new Process();
hbProc.StartInfo.FileName = "hbcli.exe";
hbProc.StartInfo.Arguments = query;
@@ -88,8 +83,8 @@ namespace Handbrake hbProc.Start();
// Set the process Priority
- string priority = Properties.Settings.Default.processPriority;
- switch (priority)
+
+ switch (Properties.Settings.Default.processPriority)
{
case "Realtime":
hbProc.PriorityClass = ProcessPriorityClass.RealTime;
@@ -113,22 +108,22 @@ namespace Handbrake hbProc.WaitForExit();
hbProc.Close();
- counter++;
- updateUIElements(progressSplit);
+ updateUIElements();
}
}
- private void updateUIElements(int progressSplit)
+ private void updateUIElements()
{
if (this.InvokeRequired)
{
- this.BeginInvoke(new ProgressUpdateHandler(updateUIElements), new object[] { progressSplit });
+ this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
return;
}
- this.list_queue.Items.Remove(0);
- progressBar.Value = progressBar.Value + progressSplit;
+ this.list_queue.Items.RemoveAt(0);
+ progressBar.PerformStep();
+ lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
progressBar.Update();
}
}
|