How to close MessageBox programmatically in WP8?

I know there are already questions with questions regarding the software closing of MessageBox. But the solution to these issues is to use a timer.

I am trying to develop an NFC application, so when I create a MessageBox it contains the message Please Tap Your NFC . Technically, the timer does not help. I need a way to close or remove a MessageBox.

Please advice.

+4
source share
2 answers

You can create your own window yourself, as described in the question that you linked. However, instead of a timer, you can enable the Hide method, which you can call as soon as an NFC connection event occurs.

Alternatively, you can get the Coding4Fun toolkit and use the MessagePrompt class, which already contains the Hide method.

+3
source

From lieska to MessageBox.Show in closing / disabling events

Register your BackKeyPress event on RootFrame.

 RootFrame.BackKeyPress += BackKeyPressed; private void BackKeyPressed(object sender, CancelEventArgs e) { var result = (MessageBox.Show("Do you want to exit XXXXX?", "Application Closing", MessageBoxButton.OKCancel)); if (result == MessageBoxResult.Cancel) { // Cancel default navigation e.Cancel = true; } } 
0
source

Source: https://habr.com/ru/post/1483707/


All Articles