Reputation: 2210
How can i kill the application in xamarin.mac I cant find this.dispose
or Application.Exit
in xamarinMac So How can I kill the application in Xamarin Mac
Upvotes: 5
Views: 2301
Reputation: 1
I was able to just use Quit in the application class itself. So as part of the application, I created a page and when that page closed, I called quit. Here is my example:
public App()
{
InitializeComponent();
if (Device.RuntimePlatform == Device.iOS)
MainPage = new MainPage();
else
MainPage = new NavigationPage(new MainPage());
MainPage.Disappearing += MainPage_Disappearing;
}
void MainPage_Disappearing(object sender, EventArgs e)
{
this.Quit();
}
Upvotes: 0
Reputation: 1315
NSApplication.SharedApplication.Terminate(this)
or from static methods
NSApplication.SharedApplication.Terminate(NSApplication.SharedApplication);
Upvotes: 11
Reputation: 63183
You should use NSApplication.Terminate
.
http://macapi.xamarin.com/?link=M%3aMonoMac.AppKit.NSApplication.Terminate
according to
How to quit itself in Objective-C application?
Upvotes: 1