달력

52024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
반응형

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
 
namespace App11BackButton
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }
 
        protected override bool OnBackButtonPressed()
        {
            Device.BeginInvokeOnMainThread(async () =>
            {                
                if (await this.DisplayAlert("알림!""닫을래?""Yes""No"))
                {                    
                    System.Diagnostics.Process.GetCurrentProcess().CloseMainWindow();
                }
            });            
            return true;
        }
    }
}
 
cs


실행

 


참조 : http://ionemind.com/content/exit-ios-and-android-mobile-app-xamarin


다른데는 Dependency써서 하라고 되어있는데 간단하게 되네....자마린은 역시 머가 먼지 모르겠다.


'프로그래밍 > xamarin' 카테고리의 다른 글

[xamarin]팝업창-AbsoluteLayout  (0) 2018.07.08
[xamarin]Lottie Animation  (0) 2018.06.10
[xamarin]CustomRenderers  (0) 2018.06.03
[xamarin]Alert Dialog  (0) 2018.05.27
[xamarin] Profile UI Design  (0) 2018.05.20
Posted by 유령회사
|