[Mono-osx] Create window at runtime

Michael Hutchinson m.j.hutchinson at gmail.com
Fri Feb 3 19:50:42 UTC 2012


On 2 February 2012 16:25, De Santis Luca <farolfo at hotmail.com> wrote:
> I've try with this code but with this simple class:
>
> using System;
> using System.Drawing;
> using MonoMac.Foundation;
> using MonoMac.AppKit;
> using MonoMac.ObjCRuntime;
>
> static class Program
>         {
> static void Main (string[] args)
>                 {
>                         MonoMac.AppKit.NSApplication.Init ();
>
>                         using (var p = new
> MonoMac.Foundation.NSAutoreleasePool ()) {
>
> MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
>                                 MonoMac.AppKit.NSApplication.Main(args);
>                         }
>                 }
>         }
>
>         class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
>         {
> MonoMac.AppKit.NSWindow app_window;
> public AppDelegate()
> {
> app_window = new MonoMac.AppKit.NSWindow(new
> RectangleF(800,480,0,400),NSWindowStyle.Borderless,NSBackingStore.Buffered,true);
> app_window.MakeKeyAndOrderFront(this);
> }
>         }
>
> But the application don't fint info.plist:
>
> mono[1304:903] No Info.plist file in application bundle or no
> NSPrincipalClass in the Info.plist file, exiting
>
> How I can build a simple executable ora a .net dll like Linux or Windows
> without bundle structure ?

Cocoa apps (i.e. MonoMac) are expected to run from within an app
bundle. You can work around this requirement but it's not recommended.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Mono-osx mailing list