59
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 using System.Collections.Specialized;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 using System.Windows;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 using SilverlightGlimpse.Models;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 using SilverlightGlimpse.Services;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 namespace SilverlightGlimpse.Controls
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 public partial class GlimpseViewer
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 public GlimpseViewer()
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 InitializeComponent();
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 this.DataContext = GlimpseService.CreateInstance;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 GlimpseService.CreateInstance.HostExceptions.CollectionChanged += HostExceptions_CollectionChanged;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 }
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 private void btnContract_Click(object sender, System.Windows.RoutedEventArgs e)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 this.layoutViewer.Visibility = Visibility.Collapsed;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 }
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 private void btnExpand_Click(object sender, System.Windows.RoutedEventArgs e)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 this.layoutViewer.Visibility = Visibility.Visible;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 }
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 private void HostExceptions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 int unhandledExceptionCount = 0;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 int validationExceptionCount = 0;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33 foreach (ExceptionWrapper ew in GlimpseService.CreateInstance.HostExceptions)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 if (ew.IsValidationException)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
36 validationExceptionCount++;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
37 else
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
38 unhandledExceptionCount++;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
39 }
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
40
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41 this.tbValidationExceptions.Text = validationExceptionCount.ToString();
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
43 this.elpValidationExceptions.Fill = validationExceptionCount == 0
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
44 ? this.noExceptionsBrush
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
45 : this.hasExceptionsBrush;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
46
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
47 this.tbUnhandledExceptions.Text = unhandledExceptionCount.ToString();
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
48
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
49 this.elpUnhandledExceptions.Fill = unhandledExceptionCount == 0
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
50 ? this.noExceptionsBrush
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
51 : this.hasExceptionsBrush;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
52 }
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
53 }
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
54 } |