开发者

How to quit MonoMac app when window closes?

开发者 https://www.devze.com 2023-03-06 23:01 出处:网络
I can use - (BOOL)applicationShouldTerminateAfterLastWindowClosed: method to quit cocoa app when window closes by using开发者_StackOverflow社区 the method in application\'s delegate.

I can use - (BOOL)applicationShouldTerminateAfterLastWindowClosed: method to quit cocoa app when window closes by using开发者_StackOverflow社区 the method in application's delegate.

How can I do the same thing with MonoMac? In general, how can I map objective-c method to MonoMac's C# function?


I found this code, I see that I can use the same function in the delegate.

namespace AnimatingViews
{
    public partial class AppDelegate : NSApplicationDelegate
    {
        AnimatingViewsWindowController animatingViewsWindowController;

        public AppDelegate ()
        {
        }

        public override void FinishedLaunching (NSObject notification)
        {
            animatingViewsWindowController = new AnimatingViewsWindowController ();
            animatingViewsWindowController.Window.MakeKeyAndOrderFront (this);
        }

        public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
        {
            return true;
        }
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号