开发者

Recognizing back click on WP7 Camera

开发者 https://www.devze.com 2023-03-05 01:41 出处:网络
In my WP7 application I need to the user to take a picture before arriving to page X. So on my main page, when the user click the button to navigate to page X, I call page X with the following constru

In my WP7 application I need to the user to take a picture before arriving to page X. So on my main page, when the user click the button to navigate to page X, I call page X with the following constructor:

Public Sub New()
    Me.Visibility = Visibility.Collapsed
    InitializeComponent()
    Me.Camera = New CameraCaptureTask
End Sub

and then on the "loaded" event I call to Me.Camera.Show()

On the "Camera.Completed" I show the page again (Me.Visibility = Visibility.Visible).

Now for the problem - If the user, while on te camera screen, click the phone's back button, the page that appears is Page X without the mandatory picture while I want (and the user must have meant) to go back to the main page.

So how can I override this behavior and开发者_JAVA技巧 make the app go back to main page if clicking back from the camera screen?

Thanks,

Alon


I'm not familiar with Visual Basic, so I can't really provide any code. However, what I would do is check if the PhotoResult's stream is null when the Completed event is fired. If it is null, then a picture has not been taken and you can prompt the user to take a picture (or whatever you want to do). If it is not null, then carry on as normal. Alternatively, you could take a look at the PhotoResult's TaskResult property to determine what happened.

0

精彩评论

暂无评论...
验证码 换一张
取 消