diff SilverlightGlimpse/Controls/ExceptionsViewer.xaml.cs @ 59:3591c26bd63e

MVVMLight added
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sat, 21 Apr 2012 19:20:28 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SilverlightGlimpse/Controls/ExceptionsViewer.xaml.cs	Sat Apr 21 19:20:28 2012 +0100
@@ -0,0 +1,39 @@
+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;
+            }
+        }
+    }
+}
\ No newline at end of file