From d318722e70e011648919ae8fb1b8e6dd11609c91 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Fri, 11 Jan 2008 20:18:51 +0000 Subject: [PATCH] Possible performance improvement. --- Source/Examples/WinForms/W03_Extensions.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Examples/WinForms/W03_Extensions.cs b/Source/Examples/WinForms/W03_Extensions.cs index 57e150f0..fa7fb5fb 100644 --- a/Source/Examples/WinForms/W03_Extensions.cs +++ b/Source/Examples/WinForms/W03_Extensions.cs @@ -76,8 +76,10 @@ namespace Examples.WinForms if (d != null) ++supported; - backgroundWorker1.ReportProgress((int)(((float)i / all) * 100.0f), - String.Format("({0}/{1}) {2}:\t{3}", (++i).ToString(), all, d != null ? "ok" : "failed", f.Name)); + //if (i % 500 != 0) + backgroundWorker1.ReportProgress((int)(((float)i / all) * 100.0f), + String.Format("({0}/{1}) {2}:\t{3}", i.ToString(), all, d != null ? "ok" : "failed", f.Name)); + ++i; } } catch (Exception expt) @@ -87,9 +89,11 @@ namespace Examples.WinForms } } + List items = new List(); private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { - listBox1.Items.Add(e.UserState as string); + items.Add(e.UserState as string); + //listBox1.Items.Add(e.UserState as string); /* if ((e.UserState as string).Contains("failed")) { @@ -106,6 +110,7 @@ namespace Examples.WinForms private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { + listBox1.Items.AddRange(items.ToArray()); this.Text = String.Format("{0}: {1}/{2} OpenGL functions supported.", driver, supported, all); }