Jatin
Jatin

Reputation: 462

Windows Phone App Exit Notification

Exit Notifier

I saw this really cool feature in a app. Currently I am showing MessageBox to ask if User wants to exit app. But as shown in Image this ExitNotification comes at the top of page like a Push Notification and if User presses back button once more the app exits. Please help me how can i create similar notification. Thanks.

Upvotes: 3

Views: 363

Answers (2)

Kumar
Kumar

Reputation: 864

That Control is ToastPrompt from Coding4fun toolkit. To begin using ToastPrompt first add a reference to the Coding4Fun.Phone.Controls.dll assembly.

After that create ToastPrrompt like this in method OnBackKeyPress from Here

protected override void OnBackKeyPress(CancelEventArgs e)
    {
        if (!isExit)
        {
            isExit = true;
            var toast = new ToastPrompt();
            toast.Message = "Press back again to exit?";
            toast.MillisecondsUntilHidden = 3000;
            toast.Completed += (o, ex) => { isExit = false; };
            toast.Show();
            e.Cancel = true;
        }
        else
        {
            NavigationService.RemoveBackEntry();
        }
    }

Note : You have to create bool variable as isExit & MillisecondsUntilHidden is count of time to display popup in millseconds.

Thanks to Coding4Fun guys

Upvotes: 1

Amit Bhatiya
Amit Bhatiya

Reputation: 2621

for achieving this you can use PopUp Control. You can show popup on the top of LayoutRoot Grid of the Application Page. For Creating PopUp you can have Reference from here How to use Pop-Ups in Windows Phone

Upvotes: 2

Related Questions