Namespace UTSModule.Test.StatusMonitor
    Public Class TestStatusChangedEventArgs
        Inherits EventArgs

        Sub New(status As TestStatusMonitor.TestStatusEnum)
            Me.Status = status
        End Sub

        Public Property Status As TestStatusMonitor.TestStatusEnum
    End Class


    Public Class TestStatusMonitor
        Enum TestStatusEnum
            ''' <summary>
            ''' 待机测试
            ''' </summary>
            WaitForTest
            ''' <summary>
            ''' 正在测试中
            ''' </summary>
            Testing
            ''' <summary>
            ''' 测试通过
            ''' </summary>
            TestPass
            ''' <summary>
            ''' 测试失败
            ''' </summary>
            TestFail
            ''' <summary>
            ''' 设备异常
            ''' </summary>
            DeviceError
        End Enum

        Public Delegate Sub TestStatusChangedEventHandler(sender As Object, e As TestStatusChangedEventArgs)

        ''' <summary>
        ''' 在测试状态更改时发生
        ''' </summary>
        Public Shared Event TestStatusChanged As TestStatusChangedEventHandler


        Private Shared _testStatus As TestStatusEnum = TestStatusEnum.WaitForTest

        ''' <summary>
        ''' 测试状态
        ''' </summary>
        ''' <returns>测试状态</returns>
        Public Shared Property TestStatus() As TestStatusEnum
            Get
                Return _testStatus
            End Get
            Set(value As TestStatusEnum)
                If _testStatus = value Then Return
                _testStatus = value
                RaiseEvent TestStatusChanged(Nothing, New TestStatusChangedEventArgs(_testStatus))
            End Set
        End Property
    End Class
End Namespace