view Glimpse/Glimpse Controls/GlimpseViewer.xaml.vb @ 72:177a9d1eba10

Latest version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Mon, 23 Apr 2012 17:57:21 +0100
parents 3591c26bd63e
children
line wrap: on
line source

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