diff options
author | brianmario <[email protected]> | 2007-07-15 18:18:06 +0000 |
---|---|---|
committer | brianmario <[email protected]> | 2007-07-15 18:18:06 +0000 |
commit | c1b0482386b3d1c8d4dc0b21ac140d0e09ac2ef3 (patch) | |
tree | 87d489aa2e8e2282b043fa716f7e581eca82ac3c /win/C#/frmQueue.cs | |
parent | c2162ba1f399eec309e12c328e82de32d81b856a (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.cs | 15 |
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();
}
|