Beispiel #1
0
        /// <summary>
        /// Entry point for our application
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Application started..");
                Console.WriteLine("pwd {0}", Environment.CurrentDirectory);
                Trace.AutoFlush = true;
                NSApplication.sharedApplication();

                Console.WriteLine("bundlePath = {0}", NSBundle.mainBundle().bundlePath());
                Console.WriteLine("executablePath = {0}", NSBundle.mainBundle().executablePath());
                Console.WriteLine("resourcePath = {0}", NSBundle.mainBundle().resourcePath());

                Console.WriteLine("privateFrameworksPath = {0}", NSBundle.mainBundle().privateFrameworksPath());
                Console.WriteLine("sharedFrameworksPath = {0}", NSBundle.mainBundle().sharedFrameworksPath());
                Console.WriteLine("sharedSupportPath = {0}", NSBundle.mainBundle().sharedSupportPath());
                Console.WriteLine("builtInPlugInsPath = {0}", NSBundle.mainBundle().builtInPlugInsPath());

                var proxy = Runtime.CreateInstance <GUITest>("init");

                Console.WriteLine("pwd {0}", Environment.CurrentDirectory);
                Console.WriteLine("Load NIB: {0}", AppKitExtensionsOfNSBundle.loadNibNamed_owner_("GUI", proxy.Handle));
                Console.WriteLine("Application runned..");

                Console.WriteLine("Fields count: {0}", typeof(NSNumber).GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).Length);
                Console.WriteLine("sizeof( NSNumber ) == {0}", System.Runtime.InteropServices.Marshal.SizeOf(typeof(NSNumber)));
                Console.WriteLine("typeof( NSNumber ).IsValueType == {0}", typeof(NSNumber).IsValueType);

                var consoleReaderThread = new Thread(() =>
                {
                    while (Console.Read() != 'q')
                    {
                    }

                    NSApplication.sharedApplication().terminate_(NSApplication.sharedApplication());
                });
                consoleReaderThread.Start();

                NSApplication.sharedApplication().run();
                consoleReaderThread.Interrupt();
            }
            catch (Exception excpt)
            {
                Console.WriteLine(excpt);
            }
            finally
            {
                Console.WriteLine("Application closed..");
            }
        }