Skip to content

Instantly share code, notes, and snippets.

@chamons
Created May 22, 2015 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chamons/d450d138279ad38df720 to your computer and use it in GitHub Desktop.
Save chamons/d450d138279ad38df720 to your computer and use it in GitHub Desktop.
using System;
using Foundation;
using AppKit;
namespace CloseTest
{
public class TestDelegate : AppKit.NSWindowDelegate
{
public override bool WindowShouldClose (NSObject sender)
{
Console.WriteLine ("Should");
return true;
}
public override void WillClose (NSNotification notification)
{
Console.WriteLine ("On");
}
}
public partial class MainWindow : NSWindow
{
public MainWindow (IntPtr handle) : base (handle)
{
}
[Export ("initWithCoder:")]
public MainWindow (NSCoder coder) : base (coder)
{
}
public override void AwakeFromNib ()
{
base.AwakeFromNib ();
this.Delegate = new TestDelegate();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment