Sub Process_Globals
Public App As Application
Public NavControl As NavigationController
PrivatePage1AsPage
Private ImageView1 As ImageView
Private cam As Camera
Private btnChoosePicture As Button
Private btnTakePicture As Button
Private btnTakeVideo As Button
Private vv As VideoView
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
NavControl.NavigationBarVisible = False
Page1.RootPanel.Color = Colors.White
Page1.RootPanel.LoadLayout("1")
NavControl.ShowPage(Page1)
cam.Initialize("cam", Page1)
'disable unsupported features
btnTakePicture.Enabled = cam.IsSupported
btnTakeVideo.Enabled = cam.IsVideoSupported
vv.Initialize("vv")
Page1.RootPanel.AddView(vv.View, ImageView1.Left, ImageView1.Top, _
ImageView1.Width, ImageView1.Height)
vv.View.Visible = False
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
'resize the VideoView to the same size as the ImageView.
vv.View.SetLayoutAnimated(0, 1, ImageView1.Left, ImageView1.Top, _
ImageView1.Width, ImageView1.Height)
End Sub
Sub btnTakeVideo_Click
cam.TakeVideo
End Sub
Sub btnTakePicture_Click
cam.TakePicture
End Sub
Sub btnChoosePicture_Click
cam.SelectFromSavedPhotos(Sender, cam.TYPE_ALL)
End Sub
Sub Cam_Complete (Success As Boolean, Image As Bitmap, VideoPath As String)
If Success Then
If Image.IsInitialized Then
vv.View.Visible = False
ImageView1.Bitmap = Image
Else
vv.View.Visible = True
vv.LoadVideo(VideoPath, "")
EndIf
EndIf
End Sub