Example #1
0
        static void Main(string[] args)
        {
            // if (IntPtr.Size == 4)
            //  {
            //       Debug.Assert(false, "sciter.dll that comes bundled in my_sciter_demo02 is the x64 version, make sure to change it to the x86 version if building for x86 (Windows only)");
            //   }

#if WINDOWS
            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);
            Debug.Assert(oleres == 0);
#endif
#if GTKMONO
            PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero);
            Mono.Setup();
#endif

            /*
             *                  NOTE:
             *                  In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH.
             *                  Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system.
             */
            App.Run();
        }
Example #2
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            Mono.Setup();
            App.Run();

            // Set our custom menu with Cocoa
            if (true)
            {
                // From XIB/NIB file (editable in Xcode Interface Builder)
                NSArray arr;
                bool    res = NSBundle.MainBundle.LoadNibNamed("MainMenu", NSApplication.SharedApplication, out arr);
                Debug.Assert(res);
            }
            else
            {
                // Or we can create it programatically
                var menu1 = new NSMenu();
                menu1.AddItem(new NSMenuItem("Hi there"));
                menu1.AddItem(NSMenuItem.SeparatorItem);
                menu1.AddItem(new NSMenuItem("Exit", (sender, e) => NSApplication.SharedApplication.Terminate(menu1)));

                var menu2 = new NSMenu("Second menu");
                menu2.AddItem(new NSMenuItem("What"));
                menu2.AddItem(new NSMenuItem("Hey"));

                var menubar = new NSMenu();
                menubar.AddItem(new NSMenuItem {
                    Submenu = menu1
                });
                menubar.AddItem(new NSMenuItem {
                    Submenu = menu2
                });

                NSApplication.SharedApplication.MainMenu = menubar;
            }
        }