Adding asynchronous extension loading.

This commit is contained in:
the_fiddler 2007-09-02 23:26:12 +00:00
parent 06c0468091
commit 7b4cff49f2

View file

@ -42,6 +42,15 @@ namespace Examples.WinForms
glControl.CreateContext(); glControl.CreateContext();
listBox1.BeginInvoke(new LoadExtensionsDelegate(LoadExtensions));
}
delegate void LoadExtensionsDelegate();
void LoadExtensions()
{
glControl.MakeCurrent();
FieldInfo[] v = delegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic); FieldInfo[] v = delegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic);
int i = 0, supported = 0; int i = 0, supported = 0;
@ -53,7 +62,7 @@ namespace Examples.WinForms
Delegate d = GL.GetDelegate(f.Name, f.FieldType); Delegate d = GL.GetDelegate(f.Name, f.FieldType);
f.SetValue(null, d); f.SetValue(null, d);
this.listBox1.Items.Add(String.Format("{0}/{1} {2}: {3}", listBox1.Items.Add(String.Format("{0}/{1} {2}: {3}",
(++i).ToString(), v.Length, d != null ? "ok" : "failed", f.Name)); (++i).ToString(), v.Length, d != null ? "ok" : "failed", f.Name));
if (d != null) if (d != null)
@ -62,7 +71,7 @@ namespace Examples.WinForms
} }
} }
this.Text = String.Format("Supported extensions: {0}", supported); //this.Text = String.Format("Supported extensions: {0}", supported);
} }
catch (Exception expt) catch (Exception expt)
{ {