AppKit.ReplaceViewSeque.Perform C# (CSharp) Method

Perform() public method

Removes the Source View Controller from the stack and replaces it with the Destination View Controller.
public Perform ( ) : void
return void
		public override void Perform ()
		{
			// Cast the source and destination controllers
			var source = SourceController as NSViewController;
			var destination = DestinationController as NSViewController;

			// Is there a source?
			if (source == null) {
				// No, get the current key window
				var window = NSApplication.SharedApplication.KeyWindow;

				// Swap the controllers
				window.ContentViewController = destination;

				// Release reference to previous controller
				window.ContentViewController?.RemoveFromParentViewController ();
			} else {
				// Swap the controllers
				source.View.Window.ContentViewController = destination;

				// Release Reference to previous controller
				source.RemoveFromParentViewController ();
			}

		}
		#endregion