view SilverlightValidation/SilverlightGlimpse/Controls/ExceptionsViewer.xaml.cs @ 58:241e2f22ed3c

Latest version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sat, 21 Apr 2012 15:06:48 +0100
parents
children 3591c26bd63e
line wrap: on
line source

using System;
using System.Windows;
using SilverlightGlimpse.Models;
using System.Windows.Controls;

namespace SilverlightGlimpse.Controls 
{
    public partial class ExceptionsViewer
    {
        public ExceptionsViewer()
        {
            InitializeComponent();
        }

        private void ClearExceptions_Click(object sender, RoutedEventArgs e)
        {
            GlimpseService.CreateInstance.HostExceptions.Clear();
        }

        private void ExceptionsViewer_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = GlimpseService.CreateInstance.HostExceptions;
            if (GlimpseService.CreateInstance.HostExceptions.Count > 0)
                this.lbExceptions.SelectedIndex = 0;
        }

        private void lbExceptions_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.lbExceptions.SelectedItem != null && this.lbExceptions.SelectedItem is ExceptionWrapper)
            {
                if (((ExceptionWrapper)this.lbExceptions.SelectedItem).IsValidationException)
                    this.tbAction.Visibility = Visibility.Visible;
                else
                    this.tbAction.Visibility = Visibility.Collapsed;
            }
        }
    }
}