Mercurial > silverbladetech
changeset 64:ba89e36631bc
Latest version
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Sun, 22 Apr 2012 14:20:52 +0100 |
parents | 536498832a79 |
children | 5d0c5cc83a7a |
files | SilverlightGlimpse/SilverlightGlimpse.Test/BuggyControl.xaml SilverlightGlimpse/SilverlightGlimpse.Test/BuggyControl.xaml.cs SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs SilverlightGlimpse/SilverlightGlimpse.Test/SilverlightGlimpse.Test.csproj SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml.cs SilverlightGlimpse/SilverlightGlimpse/Models/BrokenBinding.cs SilverlightGlimpse/SilverlightGlimpse/Models/ExceptionWrapper.cs |
diffstat | 9 files changed, 101 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/BuggyControl.xaml Sun Apr 22 13:33:42 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -<UserControl x:Class="SilverlightGlimpse.Test.BuggyControl" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - d:DesignHeight="300" - d:DesignWidth="400" - mc:Ignorable="d"> - - <Grid x:Name="LayoutRoot" Background="White"> - <ListBox x:Name="listbox1" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> - <ListBox.ItemsPanel> - <ItemsPanelTemplate> - <c:WrapPanel ItemHeight="100" - ItemWidth="100" - Orientation="Horizontal" /> - </ItemsPanelTemplate> - </ListBox.ItemsPanel> - <ListBox.ItemTemplate> - <DataTemplate> - <StackPanel Margin="20" HorizontalAlignment="Center"> - <Viewbox> - <Grid x:Name="backgroundGrid" - Width="48" - Height="48"> - <Rectangle x:Name="Rect" Fill="Orange" /> - <TextBlock x:Name="LabelForIdProperty" - HorizontalAlignment="Center" - VerticalAlignment="Center" - FontFamily="Segoe UI" - FontSize="24" - Foreground="White" - Text="{Binding INCORRECTPATH}" /> - </Grid> - </Viewbox> - </StackPanel> - </DataTemplate> - </ListBox.ItemTemplate> - </ListBox> - </Grid> -</UserControl>
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/BuggyControl.xaml.cs Sun Apr 22 13:33:42 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -using System.Collections.Generic; - -namespace SilverlightGlimpse.Test -{ - public partial class BuggyControl - { - public BuggyControl() - { - InitializeComponent(); - - var list = new List<object>(5) - { - new Person { Id = 1 , Name = "Steve"}, - new Person { Id = 2 , Name = "Dave"}, - new Person { Id = 3 , Name = "Bob"}, - new Person { Id = 4 , Name = "Rich"}, - new Person { Id = 5 , Name = "Clare"} - }; - - listbox1.ItemsSource = list; - } - } - - public class Person - { - public int Id { get; set; } - public string Name { get; set; } - } -}
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml Sun Apr 22 13:33:42 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml Sun Apr 22 14:20:52 2012 +0100 @@ -2,7 +2,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:SilverlightGlimpse.Test" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="300" d:DesignWidth="400" @@ -10,10 +9,31 @@ <Grid x:Name="LayoutRoot" Background="White"> <Grid.RowDefinitions> - <RowDefinition Height="800" /> + <RowDefinition Height="300" /> + <RowDefinition Height="Auto" /> </Grid.RowDefinitions> - <local:BuggyControl /> + <ListBox x:Name="listbox1"> + <ListBox.ItemTemplate> + <DataTemplate> + <Grid x:Name="backgroundGrid" + Width="40" + Height="40"> + <Rectangle Fill="Orange" /> + <TextBlock x:Name="LabelForIdProperty" + HorizontalAlignment="Center" + FontSize="24" + Foreground="White" + Text="{Binding IncorrectPathName}" /> + </Grid> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + + <Button x:Name="btnThrowException" + Grid.Row="1" + Click="" + Content="Throw Exception" /> </Grid> </UserControl>
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs Sun Apr 22 13:33:42 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs Sun Apr 22 14:20:52 2012 +0100 @@ -1,4 +1,8 @@ -namespace SilverlightGlimpse.Test +using System; +using System.Collections.Generic; +using System.Windows; + +namespace SilverlightGlimpse.Test { public partial class MainPage { @@ -7,7 +11,35 @@ InitializeComponent(); // uncomment this exception to view exception on startup - //throw new Exception("This exception has been thrown to demonstrate an exception during startup", new Exception("This is an inner exception")); + //ThrowNestedException(); + + var list = new List<object>(5) + { + new Person { Id = 1 , Name = "Steve"}, + new Person { Id = 2 , Name = "Dave"}, + new Person { Id = 3 , Name = "Bob"}, + new Person { Id = 4 , Name = "Rich"}, + new Person { Id = 5 , Name = "Clare"} + }; + + listbox1.ItemsSource = list; + } + + private void ThrowNestedException() + { + throw new Exception("Oh dear we've hit an exception!", + new Exception("This is an inner exception")); + } + + private void btnThrowException_Click(object sender, RoutedEventArgs e) + { + ThrowNestedException(); } } + + public class Person + { + public int Id { get; set; } + public string Name { get; set; } + } }
--- a/SilverlightGlimpse/SilverlightGlimpse.Test/SilverlightGlimpse.Test.csproj Sun Apr 22 13:33:42 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse.Test/SilverlightGlimpse.Test.csproj Sun Apr 22 14:20:52 2012 +0100 @@ -67,7 +67,6 @@ <Reference Include="system" /> <Reference Include="System.Core" /> <Reference Include="System.Windows.Controls, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> - <Reference Include="System.Windows.Controls.Toolkit, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> <Reference Include="System.Xml" /> <Reference Include="System.Windows.Browser" /> </ItemGroup>
--- a/SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml Sun Apr 22 13:33:42 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml Sun Apr 22 14:20:52 2012 +0100 @@ -2,9 +2,37 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Loaded="BrokenBindings_Loaded"> + <Grid x:Name="LayoutRoot" Background="White"> - <ScrollViewer> - <ItemsControl x:Name="icBrokenBindings" /> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + + <StackPanel Grid.Row="0" Orientation="Horizontal"> + <TextBlock Width="125" + Margin="7,0,0,0" + Text="Control Name" /> + <TextBlock Width="100" Text="Type" /> + <TextBlock Width="100" Text="Property" /> + <TextBlock Width="100" Text="Path" /> + </StackPanel> + + <ScrollViewer Grid.Row="1"> + <ListBox x:Name="lbBindings"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" ToolTipService.ToolTip="{Binding ToStringProperty}"> + <TextBlock Width="125" Text="{Binding ControlName}" /> + <TextBlock Width="100" Text="{Binding ControlTypeName}" /> + <TextBlock Width="100" Text="{Binding PropertyName}" /> + <TextBlock Text="{Binding Path}" /> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + <!-- <ItemsControl x:Name="icBrokenBindings" /> --> </ScrollViewer> </Grid> </UserControl>
--- a/SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml.cs Sun Apr 22 13:33:42 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml.cs Sun Apr 22 14:20:52 2012 +0100 @@ -16,7 +16,8 @@ private void BrokenBindings_Loaded(object sender, RoutedEventArgs e) { - icBrokenBindings.Items.Clear(); + //icBrokenBindings.Items.Clear(); + lbBindings.Items.Clear(); LoadBrokenBindings(GlimpseService.CreateInstance.RootVisual); } @@ -68,7 +69,9 @@ frameworkElement.GetType().Name, fieldInfo.Name, bindingExpression.ParentBinding.Path.Path); - icBrokenBindings.Items.Add(brokenBinding); + + //icBrokenBindings.Items.Add(brokenBinding); + lbBindings.Items.Add(brokenBinding); Debug.WriteLine("Broken Binding: {0}", brokenBinding); }
--- a/SilverlightGlimpse/SilverlightGlimpse/Models/BrokenBinding.cs Sun Apr 22 13:33:42 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Models/BrokenBinding.cs Sun Apr 22 14:20:52 2012 +0100 @@ -1,12 +1,10 @@ -using System; - -namespace SilverlightGlimpse.Models +namespace SilverlightGlimpse.Models { public class BrokenBinding { #region Fields - private string _controlName = string.Empty; + private readonly string _controlName = string.Empty; #endregion @@ -28,7 +26,7 @@ public string ControlTypeName { get; private set; } public string Path { get; private set; } public string PropertyName { get; private set; } - + public string ToStringProperty { get { return ToString(); } } #endregion #region Methods @@ -37,10 +35,10 @@ { return string.Format( "Control Name: {0}, Type: {1}, Property: {2}, Path: {3}", - this.ControlName, - this.ControlTypeName, - this.PropertyName, - this.Path); + ControlName, + ControlTypeName, + PropertyName, + Path); } #endregion
--- a/SilverlightGlimpse/SilverlightGlimpse/Models/ExceptionWrapper.cs Sun Apr 22 13:33:42 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Models/ExceptionWrapper.cs Sun Apr 22 14:20:52 2012 +0100 @@ -7,7 +7,7 @@ { #region Fields - private ValidationErrorEventAction _enumAction = ValidationErrorEventAction.Added; + private readonly ValidationErrorEventAction _enumAction = ValidationErrorEventAction.Added; #endregion @@ -42,7 +42,7 @@ public override string ToString() { return IsValidationException - ? string.Format("({0}) - {1}", this.Action, Exception.Message) + ? string.Format("({0}) - {1}", Action, Exception.Message) : Exception.Message; }