C# Class SourceWriter.EditorWidowDelegate

Defines a delegate for handling events on our text editor window such as asking the user to save changes to a document before closing the window.
Please see our Modified Windows Content Docs for more info: https://developer.xamarin.com/guides/mac/user-interface/working-with-windows/#Modified_Windows_Content
Inheritance: NSWindowDelegate
Show file Open project: xamarin/mac-samples

Public Methods

Method Description
DidBecomeKey ( NSNotification notification ) : void

Called when the window gains focus and becomes the active window.

We are using this method to update the preview of the document and to populate the Formatting Menu with any extra commands from the document's AppKit.TextKit.Formatter.LanguageFormatter.

DidResignKey ( NSNotification notification ) : void

Called when the window loses focus and falls into the background.

We are using this method to remove any custom commands added to the Formatting Menu by the AppKit.TextKit.Formatter.LanguageFormatter.

EditorWidowDelegate ( NSWindow window ) : System

Initializes a new instance of the SourceWriter.EditorWidowDelegate class.

WindowShouldClose ( Foundation sender ) : bool

Called before an NSWindow is closed. If the contents of the window has changed and not been saved, display a dialog allowing the user to: a) Cancel the closing, b) Close without saving, c) Save the changes to the document.

Method Details

DidBecomeKey() public method

Called when the window gains focus and becomes the active window.
We are using this method to update the preview of the document and to populate the Formatting Menu with any extra commands from the document's AppKit.TextKit.Formatter.LanguageFormatter.
public DidBecomeKey ( NSNotification notification ) : void
notification NSNotification Notification.
return void

DidResignKey() public method

Called when the window loses focus and falls into the background.
We are using this method to remove any custom commands added to the Formatting Menu by the AppKit.TextKit.Formatter.LanguageFormatter.
public DidResignKey ( NSNotification notification ) : void
notification NSNotification Notification.
return void

EditorWidowDelegate() public method

Initializes a new instance of the SourceWriter.EditorWidowDelegate class.
public EditorWidowDelegate ( NSWindow window ) : System
window NSWindow The NSWindow being managed by the NSWindowController this delegate /// is attached to.
return System

WindowShouldClose() public method

Called before an NSWindow is closed. If the contents of the window has changed and not been saved, display a dialog allowing the user to: a) Cancel the closing, b) Close without saving, c) Save the changes to the document.
public WindowShouldClose ( Foundation sender ) : bool
sender Foundation The NSWindowController calling this method.
return bool