X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/10980f9b5db812487ecc118fa8f8255024624e9a..63419029fbda7d3f2f3d5984c3d2c77f341dbd79:/SuperPolarityMac/Program.cs diff --git a/SuperPolarityMac/Program.cs b/SuperPolarityMac/Program.cs index 6c3f614..e6ab5cf 100644 --- a/SuperPolarityMac/Program.cs +++ b/SuperPolarityMac/Program.cs @@ -1,26 +1,44 @@ -#region Using Statements using System; using System.Collections.Generic; using System.Linq; -#endregion +using MonoMac.AppKit; +using MonoMac.Foundation; namespace SuperPolarity { -#if WINDOWS || LINUX - /// - /// The main class. - /// - public static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - using (var superPolarity = new SuperPolarity()) - superPolarity.Run(); - } - } -#endif + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main (string[] args) + { + NSApplication.Init (); + + using (var p = new NSAutoreleasePool ()) { + NSApplication.SharedApplication.Delegate = new AppDelegate (); + NSApplication.Main (args); + } + + + } + } + + class AppDelegate : NSApplicationDelegate + { + SuperPolarity superPolarity; + + public override void FinishedLaunching (MonoMac.Foundation.NSObject notification) + { + superPolarity = new SuperPolarity(); + superPolarity.Run (); + } + + public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender) + { + return true; + } + } } + +