Mercurial > silverbladetech
diff delete me/Glimpse/Model/ExceptionWrapper.vb @ 59:3591c26bd63e
MVVMLight added
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Sat, 21 Apr 2012 19:20:28 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/delete me/Glimpse/Model/ExceptionWrapper.vb Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,71 @@ + +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