X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/4fc09567c557a1110180940cca40fd7144921026..ae4f458103f5bfa44c833a147e7852e23cc02217:/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; + } + } } + +