在我的 WP7 应用程序中,我需要用户在到达页面 X 之前拍照。因此,在我的主页上,当用户单击按钮导航到页面 X 时,我使用以下构造函数调用页面 X
Public Sub New()
Me.Visibility = Visibility.Collapsed
InitializeComponent()
Me.Camera = New CameraCaptureTask
End Sub
:我调用“已加载”事件 Me.Camera.Show()
在“Camera.Completed”上,我再次显示页面(Me.Visibility = Visibility.Visible)。
现在问题来了——
如果用户在相机屏幕上单击手机的后退按钮,则出现的页面是第 X 页,没有强制图片,而我想要(并且用户一定是有意)返回主页。
那么,如果从相机屏幕单击返回,如何覆盖此行为并使应用程序返回主页?
谢谢,
阿隆
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 make the app go back to main page if clicking back from the camera screen?
Thanks,
Alon
发布评论
评论(1)
我对 Visual Basic 不熟悉,所以我无法真正提供任何代码。但是,我要做的是检查 Completed 事件时,="nofollow">PhotoResult 的 流为
null
。如果为空,则尚未拍摄照片,您可以提示用户拍摄照片(或任何您想做的事情)。如果不为空,则照常进行。或者,您可以查看 PhotoResult 的 TaskResult 属性来确定发生了什么。
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 theCompleted
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.