2013-08-11 3 views
0

좋아요. 아래 코드를 사용하여 앱에 카메라를 표시하면 멋지게 작동합니다. 문제는 내가 멀리 탐색하고 다시 코드를 수동으로 호출 할 때까지 카메라가 보이지 않는 스택을 사용하여 응용 프로그램으로 돌아올 때입니다.Windows Phone 앱 상태 및 카메라

어떻게 자동으로 표시 할 수 있습니까?

Dim cam As New Microsoft.Devices.PhotoCamera() 

Public Sub New() 
    InitializeComponent() 
    SupportedOrientations = SupportedPageOrientation.Portrait 
End Sub 

Private Sub opening() Handles Me.Loaded 
    cam = New Microsoft.Devices.PhotoCamera() 
    viewfinderBrush.RelativeTransform = New CompositeTransform() With {.CenterX = 0.5, .CenterY = 0.5, .Rotation = 90} 
    viewfinderBrush.SetSource(cam) 
End Sub 


Private Sub Closing() Handles Me.Unloaded 
    cam.Dispose() 


End Sub 

답변

0

, 내 자신의 문제를 해결 단지 사용되는 보호 오버라이드 (override)하는 서브 우퍼 :

Protected Overrides Sub OnNavigatedTo(e As NavigationEventArgs) 
    MyBase.OnNavigatedTo(e) 
    cam = New Microsoft.Devices.PhotoCamera() 
    viewfinderBrush.RelativeTransform = New CompositeTransform() With {.CenterX = 0.5, .CenterY = 0.5, .Rotation = 90} 
    viewfinderBrush.SetSource(cam) 
End Sub 

Protected Overrides Sub OnNavigatedFrom(e As NavigationEventArgs) 
    MyBase.OnNavigatedFrom(e) 

    If cam IsNot Nothing Then 
     cam.Dispose() 
     cam = Nothing 
    End If 
End Sub 

과 같이 사전에 Youuu 감사