Browse Source

improve information provided in WpfDocumentError

pull/18/head
Siegfried Pammer 14 years ago
parent
commit
d01ae06ee0
  1. 70
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfDocumentError.xaml
  2. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfDocumentError.xaml.cs
  3. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs

70
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfDocumentError.xaml

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<UserControl
x:Class="ICSharpCode.WpfDesign.AddIn.WpfDocumentError" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="#888">
@ -6,50 +6,72 @@ @@ -6,50 +6,72 @@
Background="#DDD"
BorderBrush="#999"
BorderThickness="2"
Height="150"
Width="500">
Width="500"
VerticalAlignment="Center"
MaxHeight="380">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Color="#777"
ShadowDepth="2" />
</Border.Effect>
<Grid>
<Image
Name="ErrorIcon"
Width="32"
Height="32"
Margin="10,10,0,0"
Source="../Images/Icons.32x32.Error.png"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
<TextBlock
Text="Problem Loading"
Foreground="#333"
Margin="50,10,0,0"
FontSize="16" />
<StackPanel
Orientation="Vertical">
<StackPanel
Orientation="Horizontal"
Height="50"
HorizontalAlignment="Left">
<Image
Margin="10,10,0,5"
Name="ErrorIcon"
Width="32"
Height="32"
Source="../Images/Icons.32x32.Error.png"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
<TextBlock
Text="Problem Loading"
Foreground="#333"
FontSize="16"
Margin="10,10,0,5"
VerticalAlignment="Center"
HorizontalAlignment="Left" />
</StackPanel>
<Line
Y1="5"
Y2="5"
X1="50"
X2="450"
Y1="40"
Y2="40"
Stroke="#444"
StrokeThickness="0.5" />
<TextBlock
TextWrapping="Wrap"
Text="The document contains errors which should be fixed so that the designer can load. Switch to XAML Tab to fix the errors."
Margin="50,50,20,0"
VerticalAlignment="Top"
FontSize="14"
Foreground="#333" />
Foreground="#333"
HorizontalAlignment="Left"
Margin="50,10,10,10" />
<TextBlock
Margin="50,0,0,20"
HorizontalAlignment="Left"
VerticalAlignment="Bottom">
VerticalAlignment="Bottom"
Margin="50,10,10,10">
<Hyperlink
Foreground="Black"
Click="ViewXaml">View XAML</Hyperlink>
</TextBlock>
</Grid>
<GroupBox
x:Name="additionalInfoBox"
Header="Additional information"
Margin="50,10,10,20">
<TextBox
Margin="3"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
x:Name="additionalInfo"
IsReadOnly="True"
MinLines="10" />
</GroupBox>
</StackPanel>
</Border>
</UserControl>

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfDocumentError.xaml.cs

@ -14,9 +14,13 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -14,9 +14,13 @@ namespace ICSharpCode.WpfDesign.AddIn
/// </summary>
public partial class WpfDocumentError : UserControl
{
public WpfDocumentError()
public WpfDocumentError(Exception e = null)
{
InitializeComponent();
if (e != null)
additionalInfo.Text = e.ToString();
else
additionalInfoBox.Visibility = Visibility.Collapsed;
}
void ViewXaml(object sender,RoutedEventArgs e)

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs

@ -101,13 +101,12 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -101,13 +101,12 @@ namespace ICSharpCode.WpfDesign.AddIn
propertyGridView.PropertyGrid.SelectedItems = null;
designer.DesignContext.Services.Selection.SelectionChanged += OnSelectionChanged;
designer.DesignContext.Services.GetService<UndoService>().UndoStackChanged += OnUndoStackChanged;
} catch {
this.UserContent = new WpfDocumentError();
} catch (Exception e) {
this.UserContent = new WpfDocumentError(e);
}
}
}
private MemoryStream _stream;
protected override void SaveInternal(OpenedFile file, System.IO.Stream stream)

Loading…
Cancel
Save