view SilverlightGlimpse/Controls/ExceptionsViewer.xaml.cs @ 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

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

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;
            }
        }
    }
}