private MethodInfo FindExampleMain(ExampleItem example) { var ns = "Examples." + example.Path.Replace("/", "."); var types = Assembly.GetAssembly(GetType()).DefinedTypes.Where(x => x.Namespace == ns); return(types .SelectMany(x => x.DeclaredMethods) .Single(x => x.Name == "Main" && x.IsStatic)); }
private void LaunchExample(ExampleItem example) { MethodInfo exampleMain = FindExampleMain(example); var args = view.Arguments.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); CopyExampleAssets(example.Path); try { view.Hide(); exampleMain.Invoke(null, new object[] { args }); } finally { view.Show(); } GC.Collect(); DeleteAssets(); }
public ExampleEventArgs(ExampleItem example) { this.example = example; }