Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added UnhandledExceptionDialog.xaml

  • Loading branch information...
commit 6c4db803e54234d61ded9a09b9e999c8aee38f9c 1 parent 71740c0
@markrendle authored
View
1  .gitignore
@@ -20,3 +20,4 @@ apply_config.bat
NDependOut
*.dotCover
*_mm_cache.bin
+Simple.Data.Pad.sln.DotSettings.user
View
4 Simple.Data.Pad/App.xaml.cs
@@ -20,8 +20,8 @@ protected override void OnStartup(StartupEventArgs e)
void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
- var unhandledExceptionDialog = new UnhandledExceptionDialog(e);
- unhandledExceptionDialog.ShowDialog();
+ var unhandledExceptionDialog = new UnhandledExceptionDialog(e.Exception);
+ e.Handled = unhandledExceptionDialog.ShowDialog().GetValueOrDefault();
}
}
}
View
1  Simple.Data.Pad/Simple.Data.Pad.csproj
@@ -165,7 +165,6 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
- <None Include="Simple.Data.Pad_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Simple.Data.Interop\Simple.Data.Interop.csproj">
View
24 Simple.Data.Pad/UnhandledExceptionDialog.xaml
@@ -0,0 +1,24 @@
+<Window x:Class="Simple.Data.Pad.UnhandledExceptionDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Title="UnhandledExceptionDialog" Height="300" Width="300">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="*"/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+ <TextBlock TextWrapping="Wrap" Margin="4">An error happened. It is unclear whether this is your fault or mine.</TextBlock>
+ <TextBox Grid.Row="1"
+ AcceptsReturn="True"
+ x:Name="ExceptionTextBox"
+ IsReadOnly="True"
+ IsReadOnlyCaretVisible="True"/>
+ <StackPanel Grid.Row="2"
+ Orientation="Horizontal"
+ HorizontalAlignment="Right">
+ <Button x:Name="MyFaultButton" Margin="2" Click="MyFaultButtonClick">My fault. Carry on.</Button>
+ <Button x:Name="YourFaultButton" Margin="2" Click="YourFaultButtonClick">Your fault! Rage quit!</Button>
+ </StackPanel>
+ </Grid>
+</Window>
View
40 Simple.Data.Pad/UnhandledExceptionDialog.xaml.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Simple.Data.Pad
+{
+ /// <summary>
+ /// Interaction logic for UnhandledExceptionDialog.xaml
+ /// </summary>
+ public partial class UnhandledExceptionDialog : Window
+ {
+ private readonly Exception _exception;
+
+ public UnhandledExceptionDialog(Exception exception)
+ {
+ _exception = exception;
+ InitializeComponent();
+ ExceptionTextBox.Text = _exception.ToString();
+ }
+
+ private void MyFaultButtonClick(object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ }
+
+ private void YourFaultButtonClick(object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.