Ejemplo n.º 1
0
    static void Main(string[] args)
    {
        // Console.WriteLine("Start HelloWorldRunner");
        Console.SetIn(new AtheneStreamReader(Console.OpenStandardInput()));
        var program = new HelloWorld.Program();

        var runprogram = program.GetType().GetMethod("Main", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);

        if (runprogram != null)
        {
            runprogram.Invoke(program, new object[] { args });
        }
        // Console.WriteLine("End HelloWorldRunner");
    }
Ejemplo n.º 2
0
        private void HelloWorld_Click(object sender, RoutedEventArgs e)
        {
            //This one need NameSpace and add reference
            var helloWorld = new HelloWorld.Program();

            AllocConsole();
            helloWorld.SayHello();
            FreeConsole();

            //THis is not working due to static
            //var helloWorld = new Program();
            //helloWorld.Main(null);

            //This load assemably cannot work with NameSpace
            //Type helloWorldType = Assembly.Load("HelloWorld").GetType("Program");
            //dynamic sayHello = Activator.CreateInstance(helloWorldType);
            //AllocConsole();
            //sayHello.SayHello();
            //FreeConsole();
        }