How to close Application when click on a TabbedPage ?

Endrit14Endrit14 Member ✭✭✭

Hello guys , I am new to Xamarin, I am created a TabbedPage with 5 local pages, the last one is Exit . I want the application to close when the user press that page

Best Answer

Answers

  • seanydaseanyda GBMember ✭✭✭✭✭
  • Endrit14Endrit14 Member ✭✭✭

    @ClintStLaurent said:
    But don't do it. Its wrong for the app to quit itself. You don't see it in any other mobile app do you? Not in Facebook, your your camera app, the calculator... None of them have an option to quit.

    If you do it, your app will be rejected by the Apple App Store and by Google Play store.

    cc: @AlessandroCaliaro

    How can I make like a Display Alert with 2 option for User , Yes or No

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I like rg.plugins.popups for custom dialogs & popups like that.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    I have not a PC but it is something like

    var ret = await DisplayAlert(title, message, “yes”,”no”)
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @AlessandroCaliaro said:
    I have not a PC but it is something like

    var ret = await DisplayAlert(title, message, “yes”,”no”)

    However, if I recall, you can only call DisplayAlert that uses the default alert system, from a Page. I don't think you can call that from a ViewModel, can you?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Yes
    Something like

    Application.Current.MainPage.DisplayAlert
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @AlessandroCaliaro said:
    Yes
    Something like

    Application.Current.MainPage.DisplayAlert

    There's where I personally feel the popups nuget is adventurous. You don't have to reference UI to make it work. You call a popup directly from your ViewModel.

    Besides, once you start down this road you know you're going to outgrow that piddly little DisplayAlert soon anyway. The next request is always... "I want to add an Entry and get text back" or "I want to have 3-4 custom buttons" etc.

Sign In or Register to comment.