view Glimpse/Glimpse Controls/ExceptionsViewer.xaml.vb @ 60:fc62c971a117

upload to blog
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sat, 21 Apr 2012 21:19:39 +0100
parents 3591c26bd63e
children
line wrap: on
line source

Partial Public Class ExceptionsViewer
    Inherits UserControl

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub ClearExceptions_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        GlimpseService.CreateInstance.HostExceptions.Clear()
    End Sub

    Private Sub ExceptionsViewer_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        Me.DataContext = GlimpseService.CreateInstance.HostExceptions
        If GlimpseService.CreateInstance.HostExceptions.Count > 0 Then
            Me.lbExceptions.SelectedIndex = 0
        End If
    End Sub

    Private Sub lbExceptions_SelectionChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs)

        If Me.lbExceptions.SelectedItem IsNot Nothing AndAlso TypeOf Me.lbExceptions.SelectedItem Is ExceptionWrapper Then

            If DirectCast(Me.lbExceptions.SelectedItem, ExceptionWrapper).IsValidationException Then
                Me.tbAction.Visibility = Windows.Visibility.Visible

            Else
                Me.tbAction.Visibility = Windows.Visibility.Collapsed
            End If

        End If

    End Sub

End Class