Optimus
Optimus

Reputation: 2210

How to kill application in Xamarin.Mac

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

Answers (3)

Rob W
Rob W

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

ulmer-morozov
ulmer-morozov

Reputation: 1315

NSApplication.SharedApplication.Terminate(this)

or from static methods

NSApplication.SharedApplication.Terminate(NSApplication.SharedApplication);

Upvotes: 11

Related Questions