Mercurial > silverbladetech
changeset 74:a79e235177f5
Working version
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Mon, 23 Apr 2012 20:29:55 +0100 |
parents | d06c852e0167 |
children | c01dd64f078b |
files | SilverlightGlimpse/SilverlightGlimpse/Controls/FloatableWindow/FloatableWindow.cs SilverlightGlimpse/SilverlightGlimpse/Services/Glimpse.cs SilverlightGlimpse/SilverlightGlimpse/Views/BindingsViewer.xaml SilverlightGlimpse/SilverlightGlimpse/Views/GlimpseViewer.xaml SilverlightGlimpse/SilverlightGlimpse/Views/GlimpseViewer.xaml.cs SilverlightGlimpse/SilverlightGlimpse/Views/LogViewer.xaml SilverlightGlimpse/SilverlightGlimpse/Views/ValidationsViewer.xaml |
diffstat | 7 files changed, 68 insertions(+), 81 deletions(-) [+] |
line wrap: on
line diff
--- a/SilverlightGlimpse/SilverlightGlimpse/Controls/FloatableWindow/FloatableWindow.cs Mon Apr 23 19:15:52 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Controls/FloatableWindow/FloatableWindow.cs Mon Apr 23 20:29:55 2012 +0100 @@ -874,7 +874,7 @@ this._isMouseCaptured = true; this._clickPoint = e.GetPosition(sender as UIElement); #if DEBUG - this.Title = string.Format("X:{0},Y:{1}", this._clickPoint.X.ToString(), this._clickPoint.Y.ToString()); + //this.Title = string.Format("X:{0},Y:{1}", this._clickPoint.X.ToString(), this._clickPoint.Y.ToString()); #endif } }
--- a/SilverlightGlimpse/SilverlightGlimpse/Services/Glimpse.cs Mon Apr 23 19:15:52 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Services/Glimpse.cs Mon Apr 23 20:29:55 2012 +0100 @@ -64,8 +64,10 @@ #endregion - #region UI Creation and Loading + #region Methods + // Used when application fails to load a rootpage due to an exception. + // Silverlight Glimpse becomes the new rootpage. public void DisplayLoadFailure(Application app, Exception ex, string title) { var source = ex.StackTrace.Substring(0, ex.StackTrace.IndexOf(Environment.NewLine, StringComparison.Ordinal)); @@ -76,6 +78,8 @@ Debug.WriteLine("{0} had exception. {1}", Title, ex); } + + // Normal loading of Silverlight Glimpse. public void Load(Application app, string title, TimeSpan bindingsRefreshRate = default(TimeSpan)) { App = app; @@ -118,6 +122,14 @@ _refreshBindingCountTimer.Start(); } + public void Clear() + { + BindingErrors.Clear(); + Log.Clear(); + ValidationErrors.Clear(); + Exceptions.Clear(); + } + #endregion #region Events handlers @@ -152,8 +164,8 @@ ValidationErrors.Add( new ValidationWrapper( e.Action, - e.OriginalSource.GetType().ToString(), - controlName, + controlName, + e.OriginalSource.GetType().Name, e.Error.ErrorContent.ToString())); }
--- a/SilverlightGlimpse/SilverlightGlimpse/Views/BindingsViewer.xaml Mon Apr 23 19:15:52 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Views/BindingsViewer.xaml Mon Apr 23 20:29:55 2012 +0100 @@ -11,26 +11,24 @@ <StackPanel Grid.Row="0" Orientation="Horizontal"> <TextBlock Width="120" - Margin="10,0,0,0" + Margin="5,0,0,0" Text="Control Name" /> <TextBlock Width="120" Text="Type" /> <TextBlock Width="120" Text="Property" /> <TextBlock Width="150" Text="Path" /> </StackPanel> - <ScrollViewer Grid.Row="1"> - <ListBox x:Name="lbBindings"> - <ListBox.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" ToolTipService.ToolTip="{Binding ToStringProperty}"> - <TextBlock Width="120" Text="{Binding ControlName}" /> - <TextBlock Width="120" Text="{Binding ControlTypeName}" /> - <TextBlock Width="120" Text="{Binding PropertyName}" /> - <TextBlock Text="{Binding Path}" /> - </StackPanel> - </DataTemplate> - </ListBox.ItemTemplate> - </ListBox> - </ScrollViewer> + <ListBox x:Name="lbBindings" Grid.Row="1"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" ToolTipService.ToolTip="{Binding ToStringProperty}"> + <TextBlock Width="120" Text="{Binding ControlName}" /> + <TextBlock Width="120" Text="{Binding ControlType}" /> + <TextBlock Width="120" Text="{Binding PropertyName}" /> + <TextBlock Text="{Binding Path}" /> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> </Grid> </UserControl>
--- a/SilverlightGlimpse/SilverlightGlimpse/Views/GlimpseViewer.xaml Mon Apr 23 19:15:52 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Views/GlimpseViewer.xaml Mon Apr 23 20:29:55 2012 +0100 @@ -34,15 +34,15 @@ <StackPanel Orientation="Horizontal"> <Grid> <Ellipse x:Name="elpBindingErrors" ToolTipService.ToolTip="Binding Exception Count" /> - <TextBlock x:Name="tbBindingErrors" /> + <TextBlock x:Name="tbBindingErrors" Text="{Binding BindingErrors.Count}" /> </Grid> <Grid> - <Ellipse x:Name="elpValidationExceptions" ToolTipService.ToolTip="Validation Exception Count" /> - <TextBlock x:Name="tbValidationExceptions" /> + <Ellipse x:Name="elpValidationErrors" ToolTipService.ToolTip="Validation Exception Count" /> + <TextBlock x:Name="tbValidationErrors" Text="{Binding ValidationErrors.Count}" /> </Grid> <Grid> <Ellipse x:Name="elpUnhandledExceptions" ToolTipService.ToolTip="Unhandled Exception Count" /> - <TextBlock x:Name="tbUnhandledExceptions" /> + <TextBlock x:Name="tbUnhandledExceptions" Text="{Binding Exceptions.Count}" /> </Grid> <Button x:Name="btnExpand" Margin="7" @@ -51,20 +51,27 @@ Content="Expand" /> </StackPanel> </Grid> + <Grid x:Name="layoutViewer" Visibility="Collapsed"> <Grid.RowDefinitions> <RowDefinition Height="auto" /> </Grid.RowDefinitions> - <Button x:Name="btnContract" - HorizontalAlignment="Right" - VerticalAlignment="Top" - Click="btnContract_Click" - Content="Contract" /> + <StackPanel HorizontalAlignment="Right" + VerticalAlignment="Top" + Orientation="Horizontal"> + <Button x:Name="btnClear" + Width="30" + Click="btnClear_Click" + Content="Clear" /> - <c:TabControl Grid.Row="1" - Width="600" - Height="250"> + <Button x:Name="btnContract" + Margin="10,0,0,0" + Click="btnContract_Click" + Content="Contract" /> + </StackPanel> + + <c:TabControl Width="600" Height="250"> <c:TabItem Header="Binding"> <views:BindingsViewer />
--- a/SilverlightGlimpse/SilverlightGlimpse/Views/GlimpseViewer.xaml.cs Mon Apr 23 19:15:52 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Views/GlimpseViewer.xaml.cs Mon Apr 23 20:29:55 2012 +0100 @@ -1,5 +1,4 @@ -using System.Collections.Specialized; -using System.Windows; +using System.Windows; using SilverlightGlimpse.Services; namespace SilverlightGlimpse.Views @@ -10,7 +9,6 @@ { InitializeComponent(); DataContext = Glimpse.Service; - Glimpse.Service.Exceptions.CollectionChanged += HostExceptions_CollectionChanged; } private void btnContract_Click(object sender, RoutedEventArgs e) @@ -23,33 +21,9 @@ layoutViewer.Visibility = Visibility.Visible; } - // TODO: Sort this mess out :) - private void HostExceptions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + private void btnClear_Click(object sender, RoutedEventArgs 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; + Glimpse.Service.Clear(); } } } \ No newline at end of file
--- a/SilverlightGlimpse/SilverlightGlimpse/Views/LogViewer.xaml Mon Apr 23 19:15:52 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Views/LogViewer.xaml Mon Apr 23 20:29:55 2012 +0100 @@ -10,8 +10,6 @@ <RowDefinition Height="*" /> </Grid.RowDefinitions> - <ScrollViewer> - <ListBox x:Name="lbLog" /> - </ScrollViewer> + <ListBox x:Name="lbLog" /> </Grid> </UserControl>
--- a/SilverlightGlimpse/SilverlightGlimpse/Views/ValidationsViewer.xaml Mon Apr 23 19:15:52 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse/Views/ValidationsViewer.xaml Mon Apr 23 20:29:55 2012 +0100 @@ -8,27 +8,25 @@ </Grid.RowDefinitions> <StackPanel Grid.Row="0" Orientation="Horizontal"> - <TextBlock Width="80" - Margin="10,0,0,0" + <TextBlock Width="75" + Margin="5,0,0,0" Text="Action" /> - <TextBlock Width="120" Text="Control Name" /> - <TextBlock Width="120" Text="Type" /> + <TextBlock Width="110" Text="Control Name" /> + <TextBlock Width="140" Text="Type" /> <TextBlock Width="150" Text="Error" /> </StackPanel> - <ScrollViewer Grid.Row="1"> - <ListBox x:Name="lbValidationErrors"> - <ListBox.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" ToolTipService.ToolTip="{Binding ToStringProperty}"> - <TextBlock Width="80" Text="{Binding Action}" /> - <TextBlock Width="120" Text="{Binding ControlName}" /> - <TextBlock Width="120" Text="{Binding ControlType}" /> - <TextBlock Text="{Binding ErrorContent}" /> - </StackPanel> - </DataTemplate> - </ListBox.ItemTemplate> - </ListBox> - </ScrollViewer> + <ListBox x:Name="lbValidationErrors" Grid.Row="1"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" ToolTipService.ToolTip="{Binding ToStringProperty}"> + <TextBlock Width="75" Text="{Binding Action}" /> + <TextBlock Width="110" Text="{Binding ControlName}" /> + <TextBlock Width="140" Text="{Binding ControlType}" /> + <TextBlock Text="{Binding ErrorContent}" /> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> </Grid> </UserControl>