Mercurial > silverbladetech
view SilverlightGlimpse/Controls/GlimpseViewer.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.Collections.Specialized; using System.Windows; using SilverlightGlimpse.Models; using SilverlightGlimpse.Services; namespace SilverlightGlimpse.Controls { public partial class GlimpseViewer { public GlimpseViewer() { InitializeComponent(); this.DataContext = GlimpseService.CreateInstance; GlimpseService.CreateInstance.HostExceptions.CollectionChanged += HostExceptions_CollectionChanged; } private void btnContract_Click(object sender, System.Windows.RoutedEventArgs e) { this.layoutViewer.Visibility = Visibility.Collapsed; } private void btnExpand_Click(object sender, System.Windows.RoutedEventArgs e) { this.layoutViewer.Visibility = Visibility.Visible; } private void HostExceptions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { int unhandledExceptionCount = 0; int validationExceptionCount = 0; foreach (ExceptionWrapper ew in GlimpseService.CreateInstance.HostExceptions) { if (ew.IsValidationException) validationExceptionCount++; else unhandledExceptionCount++; } this.tbValidationExceptions.Text = validationExceptionCount.ToString(); this.elpValidationExceptions.Fill = validationExceptionCount == 0 ? this.noExceptionsBrush : this.hasExceptionsBrush; this.tbUnhandledExceptions.Text = unhandledExceptionCount.ToString(); this.elpUnhandledExceptions.Fill = unhandledExceptionCount == 0 ? this.noExceptionsBrush : this.hasExceptionsBrush; } } }