summaryrefslogtreecommitdiffstats
path: root/win/C#/frmQueue.cs
diff options
context:
space:
mode:
authorbrianmario <[email protected]>2007-07-15 18:18:06 +0000
committerbrianmario <[email protected]>2007-07-15 18:18:06 +0000
commitc1b0482386b3d1c8d4dc0b21ac140d0e09ac2ef3 (patch)
tree87d489aa2e8e2282b043fa716f7e581eca82ac3c /win/C#/frmQueue.cs
parentc2162ba1f399eec309e12c328e82de32d81b856a (diff)
WinGui: more cleanup in frmMain
fix to frmQueue for cross-thread UI updating git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@690 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmQueue.cs')
-rw-r--r--win/C#/frmQueue.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index f555ffeaf..8d9157609 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -12,7 +12,7 @@ namespace Handbrake
{
public partial class frmQueue : Form
{
- private frmQueue thisWindow;
+ private delegate void ProgressUpdateHandler(int progressSplit);
public frmQueue()
{
@@ -86,6 +86,7 @@ namespace Handbrake
hbProc.StartInfo.Arguments = query;
hbProc.StartInfo.UseShellExecute = false;
hbProc.Start();
+
// Set the process Priority
string priority = Properties.Settings.Default.processPriority;
switch (priority)
@@ -113,14 +114,20 @@ namespace Handbrake
hbProc.WaitForExit();
hbProc.Close();
counter++;
- //updateUIElements(progressSplit);
+
+ updateUIElements(progressSplit);
}
}
private void updateUIElements(int progressSplit)
{
- // This needs to be written so there is no cross-thread problems ********************
- thisWindow.list_queue.Items.Remove(0);
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new ProgressUpdateHandler(updateUIElements), new object[] { progressSplit });
+ return;
+ }
+
+ this.list_queue.Items.Remove(0);
progressBar.Value = progressBar.Value + progressSplit;
progressBar.Update();
}