Imports Windows.UI.Xaml.Navigation
Imports Windows.UI.Xaml.Media
Imports Windows.UI.Xaml.Input
Imports Windows.UI.Xaml.Data
Imports Windows.UI.Xaml.Controls.Primitives
Imports Windows.UI.Xaml.Controls
Imports Windows.UI.Xaml
Imports Windows.Foundation.Collections
Imports Windows.Foundation
Imports System.Runtime.InteropServices.WindowsRuntime
Imports System.Linq
Imports System.IO
Imports System.Collections.Generic
Imports System

' The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

''' <summary>
''' An empty page that can be used on its own or navigated to within a Frame.
''' </summary>
Partial Public NotInheritable Class InputPanelCurrentItem
    Inherits Page
    Public Sub New()
        Me.InitializeComponent()
    End Sub

    Protected Overrides Sub OnNavigatedTo(e As NavigationEventArgs)
        MyBase.OnNavigatedTo(e)
        Dim parameter As Object = e.Parameter
        If parameter IsNot Nothing Then
            Dim employee As Employee = TryCast(parameter, Employee)
            If employee IsNot Nothing Then
                InputPanel.CurrentItem = employee
            End If
        End If

        If Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons") Then
            AddHandler Windows.Phone.UI.Input.HardwareButtons.BackPressed, AddressOf HardwareButtons_BackPressed
        End If
    End Sub

    Protected Overrides Sub OnNavigatedFrom(e As NavigationEventArgs)
        If Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons") Then
            RemoveHandler Windows.Phone.UI.Input.HardwareButtons.BackPressed, AddressOf HardwareButtons_BackPressed
        End If
    End Sub

    Private Sub HardwareButtons_BackPressed(sender As Object, e As Windows.Phone.UI.Input.BackPressedEventArgs)
        If Me.Frame IsNot Nothing AndAlso Me.Frame.CanGoBack Then
            e.Handled = True
            Me.Frame.GoBack()
        End If
    End Sub
End Class