Added Ctrl-F1 command to show hidden items.

This commit is contained in:
the_fiddler 2008-01-11 20:17:36 +00:00
parent ef75237981
commit 09e6d60293

View file

@ -29,6 +29,9 @@ namespace Examples
{ {
public partial class ExampleLauncher : Form public partial class ExampleLauncher : Form
{ {
bool show_hidden;
List<ExampleInfo> hidden_items = new List<ExampleInfo>();
#region class ExampleInfo #region class ExampleInfo
/// <summary> /// <summary>
@ -92,7 +95,7 @@ namespace Examples
if (attr is ExampleAttribute) if (attr is ExampleAttribute)
example = (ExampleAttribute)attr; example = (ExampleAttribute)attr;
if (example != null && example.Visible == true) if (example != null)
{ {
sb.Append(example.Category); sb.Append(example.Category);
sb.Append(" "); sb.Append(" ");
@ -103,7 +106,10 @@ namespace Examples
//sb.Append(type.Name); //sb.Append(type.Name);
sb.Append(example.Title); sb.Append(example.Title);
listBox1.Items.Add(new ExampleInfo(type, example)); if (example.Visible && example.Category != ExampleCategory.Test)
listBox1.Items.Add(new ExampleInfo(type, example));
else
hidden_items.Add(new ExampleInfo(type, example));
// Clean the StringBuilder for the next pass. // Clean the StringBuilder for the next pass.
sb.Remove(0, sb.Length); sb.Remove(0, sb.Length);
@ -180,6 +186,19 @@ namespace Examples
case Keys.Enter: case Keys.Enter:
RunExample(); RunExample();
break; break;
// On Ctrl+F1 enable hidden items (for debugging/testing OpenTK)
case Keys.F1:
if (e.Control)
show_hidden = !show_hidden;
if (show_hidden)
listBox1.Items.AddRange(hidden_items.ToArray());
else
foreach (ExampleInfo item in hidden_items)
listBox1.Items.Remove(item);
break;
} }
} }