comparison 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
comparison
equal deleted inserted replaced
58:241e2f22ed3c 59:3591c26bd63e
1 
2 Public Class ExceptionWrapper
3
4 #Region " Declarations "
5
6 Private _bolIsValidationException As Boolean = False
7 Private _enumAction As ValidationErrorEventAction = ValidationErrorEventAction.Added
8 Private _objException As Exception
9 Private _strControlName As String = String.Empty
10
11 #End Region
12
13 #Region " Properties "
14
15 Public Sub New(ByVal enumAction As ValidationErrorEventAction, ByVal strControlName As String, ByVal objValidationException As Exception)
16 _enumAction = enumAction
17 _strControlName = strControlName
18 _objException = objValidationException
19 _bolIsValidationException = True
20 End Sub
21
22 Public ReadOnly Property Action() As ValidationErrorEventAction
23 Get
24 Return _enumAction
25 End Get
26 End Property
27
28 Public ReadOnly Property ControlName() As String
29 Get
30 Return _strControlName
31 End Get
32 End Property
33
34 Public ReadOnly Property Exception() As Exception
35 Get
36 Return _objException
37 End Get
38 End Property
39
40 Public ReadOnly Property IsValidationException() As Boolean
41 Get
42 Return _bolIsValidationException
43 End Get
44 End Property
45
46 #End Region
47
48 #Region " Constructor "
49
50 Public Sub New(ByVal objException As Exception)
51 _objException = objException
52 End Sub
53
54 #End Region
55
56 #Region " Methods "
57
58 Public Overrides Function ToString() As String
59
60 If _bolIsValidationException Then
61 Return String.Format("({0}) - {1}", Me.Action, Exception.Message)
62
63 Else
64 Return Exception.Message
65 End If
66
67 End Function
68
69 #End Region
70
71 End Class