diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Glimpse/Glimpse Controls/GlimpseViewer.xaml.vb	Sat Apr 21 19:20:28 2012 +0100
@@ -0,0 +1,54 @@
+Partial Public Class GlimpseViewer
+    Inherits UserControl
+
+    Public Sub New()
+        InitializeComponent()
+        Me.DataContext = GlimpseService.CreateInstance
+        AddHandler GlimpseService.CreateInstance.HostExceptions.CollectionChanged, AddressOf HostExceptions_CollectionChanged
+    End Sub
+
+    Private Sub btnContract_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnContract.Click
+        Me.layoutViewer.Visibility = Windows.Visibility.Collapsed
+    End Sub
+
+    Private Sub btnExpand_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnExpand.Click
+        Me.layoutViewer.Visibility = Windows.Visibility.Visible
+    End Sub
+
+    Private Sub HostExceptions_CollectionChanged(ByVal sender As Object, ByVal e As System.Collections.Specialized.NotifyCollectionChangedEventArgs)
+
+        Dim intUnhandledExceptionCount As Integer = 0
+        Dim intValidationExceptionCount As Integer = 0
+
+        For Each ew As ExceptionWrapper In GlimpseService.CreateInstance.HostExceptions
+
+            If ew.IsValidationException Then
+                intValidationExceptionCount += 1
+
+            Else
+                intUnhandledExceptionCount += 1
+            End If
+
+        Next
+
+        Me.tbValidationExceptions.Text = intValidationExceptionCount.ToString
+
+        If intValidationExceptionCount = 0 Then
+            Me.elpValidationExceptions.Fill = Me.noExceptionsBrush
+
+        Else
+            Me.elpValidationExceptions.Fill = Me.hasExceptionsBrush
+        End If
+
+        Me.tbUnhandledExceptions.Text = intUnhandledExceptionCount.ToString
+
+        If intUnhandledExceptionCount = 0 Then
+            Me.elpUnhandledExceptions.Fill = Me.noExceptionsBrush
+
+        Else
+            Me.elpUnhandledExceptions.Fill = Me.hasExceptionsBrush
+        End If
+
+    End Sub
+
+End Class