view Glimpse/Glimpse Controls/ExceptionsViewer.xaml.vb @ 78:dd6bcd2535b6

Working version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Mon, 23 Apr 2012 22:43:53 +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