view SilverlightGlimpse/SilverlightGlimpse/Views/GlimpseViewer.xaml.cs @ 71:96e6fbd70f49

Latest version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Mon, 23 Apr 2012 14:54:24 +0100
parents SilverlightGlimpse/SilverlightGlimpse/Controls/GlimpseViewer.xaml.cs@a0bcd783e612
children a79e235177f5
line wrap: on
line source

using System.Collections.Specialized;
using System.Windows;
using SilverlightGlimpse.Services;

namespace SilverlightGlimpse.Views
{
    public partial class GlimpseViewer
    {
        public GlimpseViewer()
        {
            InitializeComponent();
            DataContext = Glimpse.Service;
            Glimpse.Service.Exceptions.CollectionChanged += HostExceptions_CollectionChanged;
        }

        private void btnContract_Click(object sender, RoutedEventArgs e)
        {
            layoutViewer.Visibility = Visibility.Collapsed;
        }

        private void btnExpand_Click(object sender, RoutedEventArgs e)
        {
            layoutViewer.Visibility = Visibility.Visible;
        }

        // TODO: Sort this mess out :)
        private void HostExceptions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            //int unhandledExceptionCount = 0;
            //int validationExceptionCount = 0;

            //foreach (var ex in Glimpse.Service.Exceptions)
            //{
            //    if (ex.IsValidationException)
            //        validationExceptionCount++;
            //    else
            //        unhandledExceptionCount++;
            //}

            //tbValidationExceptions.Text = validationExceptionCount.ToString();

            //if (validationExceptionCount == 0)
            //{
            //    elpValidationExceptions.Fill = noExceptionsFill;
            //    elpValidationExceptions.Stroke = noExceptionsBorder;
            //}

            //tbUnhandledExceptions.Text = unhandledExceptionCount.ToString();

            //elpUnhandledExceptions.Fill = unhandledExceptionCount == 0
            //    ? noExceptionsBrush
            //    : hasExceptionsBrush;
        }
    }
}