comparison Glimpse/Glimpse Controls/GlimpseViewer.xaml.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 Partial Public Class GlimpseViewer
2 Inherits UserControl
3
4 Public Sub New()
5 InitializeComponent()
6 Me.DataContext = GlimpseService.CreateInstance
7 AddHandler GlimpseService.CreateInstance.HostExceptions.CollectionChanged, AddressOf HostExceptions_CollectionChanged
8 End Sub
9
10 Private Sub btnContract_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnContract.Click
11 Me.layoutViewer.Visibility = Windows.Visibility.Collapsed
12 End Sub
13
14 Private Sub btnExpand_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnExpand.Click
15 Me.layoutViewer.Visibility = Windows.Visibility.Visible
16 End Sub
17
18 Private Sub HostExceptions_CollectionChanged(ByVal sender As Object, ByVal e As System.Collections.Specialized.NotifyCollectionChangedEventArgs)
19
20 Dim intUnhandledExceptionCount As Integer = 0
21 Dim intValidationExceptionCount As Integer = 0
22
23 For Each ew As ExceptionWrapper In GlimpseService.CreateInstance.HostExceptions
24
25 If ew.IsValidationException Then
26 intValidationExceptionCount += 1
27
28 Else
29 intUnhandledExceptionCount += 1
30 End If
31
32 Next
33
34 Me.tbValidationExceptions.Text = intValidationExceptionCount.ToString
35
36 If intValidationExceptionCount = 0 Then
37 Me.elpValidationExceptions.Fill = Me.noExceptionsBrush
38
39 Else
40 Me.elpValidationExceptions.Fill = Me.hasExceptionsBrush
41 End If
42
43 Me.tbUnhandledExceptions.Text = intUnhandledExceptionCount.ToString
44
45 If intUnhandledExceptionCount = 0 Then
46 Me.elpUnhandledExceptions.Fill = Me.noExceptionsBrush
47
48 Else
49 Me.elpUnhandledExceptions.Fill = Me.hasExceptionsBrush
50 End If
51
52 End Sub
53
54 End Class