view delete me/Glimpse/Model/ExceptionWrapper.vb @ 62:810116cd6b8e

ErrorWindow working
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 09:01:20 +0100
parents 3591c26bd63e
children
line wrap: on
line source


Public Class ExceptionWrapper

#Region " Declarations "

    Private _bolIsValidationException As Boolean = False
    Private _enumAction As ValidationErrorEventAction = ValidationErrorEventAction.Added
    Private _objException As Exception
    Private _strControlName As String = String.Empty

#End Region

#Region " Properties "

    Public Sub New(ByVal enumAction As ValidationErrorEventAction, ByVal strControlName As String, ByVal objValidationException As Exception)
        _enumAction = enumAction
        _strControlName = strControlName
        _objException = objValidationException
        _bolIsValidationException = True
    End Sub

    Public ReadOnly Property Action() As ValidationErrorEventAction
        Get
            Return _enumAction
        End Get
    End Property

    Public ReadOnly Property ControlName() As String
        Get
            Return _strControlName
        End Get
    End Property

    Public ReadOnly Property Exception() As Exception
        Get
            Return _objException
        End Get
    End Property

    Public ReadOnly Property IsValidationException() As Boolean
        Get
            Return _bolIsValidationException
        End Get
    End Property

#End Region

#Region " Constructor "

    Public Sub New(ByVal objException As Exception)
        _objException = objException
    End Sub

#End Region

#Region " Methods "

    Public Overrides Function ToString() As String

        If _bolIsValidationException Then
            Return String.Format("({0}) - {1}", Me.Action, Exception.Message)

        Else
            Return Exception.Message
        End If

    End Function

#End Region

End Class