Show hidden examples in debug mode.

This commit is contained in:
the_fiddler 2008-01-17 14:06:14 +00:00
parent 01e493fb3b
commit bf269b2d0d
2 changed files with 18 additions and 11 deletions

View file

@ -13,7 +13,8 @@ namespace Examples
[AttributeUsage(AttributeTargets.Class)] [AttributeUsage(AttributeTargets.Class)]
public class ExampleAttribute : System.Attribute public class ExampleAttribute : System.Attribute
{ {
public readonly string Title; string title;
public string Title { get { return title; } internal set { title = value; } }
public readonly ExampleCategory Category; public readonly ExampleCategory Category;
public readonly int Difficulty; public readonly int Difficulty;
public readonly bool Visible = true; public readonly bool Visible = true;

View file

@ -97,21 +97,27 @@ namespace Examples
if (example != null) if (example != null)
{ {
sb.Append(example.Category); //sb.Append(example.Category);
sb.Append(" "); //sb.Append(" ");
if (example.Difficulty < 10) //if (example.Difficulty < 10)
sb.Append("0"); // To keep items nicely sorted. // sb.Append("0"); // To keep items nicely sorted.
sb.Append(example.Difficulty); //sb.Append(example.Difficulty);
sb.Append(": "); //sb.Append(": ");
//sb.Append(type.Name); ////sb.Append(type.Name);
sb.Append(example.Title); //sb.Append(example.Title);
if (example.Visible && example.Category != ExampleCategory.Test) if (example.Visible && example.Category != ExampleCategory.Test)
listBox1.Items.Add(new ExampleInfo(type, example)); listBox1.Items.Add(new ExampleInfo(type, example));
else else
{
#if DEBUG
example.Title += " (hidden)";
listBox1.Items.Add(new ExampleInfo(type, example));
#else
hidden_items.Add(new ExampleInfo(type, example)); hidden_items.Add(new ExampleInfo(type, example));
#endif
// Clean the StringBuilder for the next pass. }
// Clean the StringBuilder for the next pass.
sb.Remove(0, sb.Length); sb.Remove(0, sb.Length);
} }
} }