Namespace UTSModule.Test.StatusMonitor
    Public Class UtsKeyDownEventArgs
        Inherits EventArgs

        Public Property KeyValue As UtsKeyValueMonitor.UtsKeyValueEnum
    End Class


    Public Class UtsKeyValueMonitor
        ''' <summary>
        ''' 按键按下枚举值
        ''' </summary>
        Enum UtsKeyValueEnum
            ''' <summary>
            ''' 没有按键按下
            ''' </summary>
            None = 1
            ''' <summary>
            ''' 开始键按下
            ''' </summary>
            Start
            ''' <summary>
            ''' YES 键按下
            ''' </summary>
            Yes
            ''' <summary>
            ''' NO 键按下
            ''' </summary>
            No

            ''' <summary>
            ''' 开始键长按
            ''' </summary>
            StartLongPress

            ''' <summary>
            ''' YES 键长按
            ''' </summary>
            YesLongPress

            ''' <summary>
            ''' NO 键长按
            ''' </summary>
            NoLongPress

            ''' <summary>
            ''' 开始键松开
            ''' </summary>
            StartReleased

            ''' <summary>
            ''' Yes 键松开
            ''' </summary>
            YesReleased

            ''' <summary>
            ''' NO 键松开
            ''' </summary>
            NoReleased
        End Enum

        Public Delegate Sub UtsKeyDownEventHandler(sender As Object, e As UtsKeyDownEventArgs)

        ''' <summary>
        ''' UTS测试架按键按下
        ''' </summary>
        Public Shared Event UtsKeyDown As UtsKeyDownEventHandler


        Private Shared _utsKeyValue As UtsKeyValueEnum = UtsKeyValueEnum.None

        ''' <summary>
        ''' UTS测试架按键键值
        ''' </summary>
        ''' <returns></returns>
        Public Shared Property UtsKeyValue() As UtsKeyValueEnum
            Get
                Return _utsKeyValue
            End Get
            Set(value As UtsKeyValueEnum)
                _utsKeyValue = value

                If value <> UtsKeyValueEnum.None Then '有按键按下
                    RaiseEvent UtsKeyDown(Nothing, New UtsKeyDownEventArgs() With {.KeyValue = _utsKeyValue})
                End If
            End Set
        End Property

    End Class
End Namespace