Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit f4021475 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

removing expander, showing xml errors in dialog instead

parent 497cb140
No related branches found
No related tags found
No related merge requests found
......@@ -92,6 +92,9 @@
<Compile Include="Views\VerifyInputData.xaml.cs">
<DependentUpon>VerifyInputData.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Dialog\XMLValidationErrorsDialog.xaml.cs">
<DependentUpon>XMLValidationErrorsDialog.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -140,6 +143,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Dialog\XMLValidationErrorsDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
......
......@@ -4,7 +4,7 @@
xmlns:viewModel="clr-namespace:HashingTool.ViewModel"
xmlns:views="clr-namespace:HashingTool.Views"
x:Class="HashingTool.MainWindow"
Title="VECTO Hashing Tool" Height="534" Width="665" ResizeMode="NoResize">
Title="VECTO Hashing Tool" Height="534" Width="665" MinWidth="600" MinHeight="500">
<Window.DataContext>
<viewModel:ApplicationViewModel />
</Window.DataContext>
......
<Window x:Class="HashingTool.Views.XMLValidationErrorsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="XML Errors/Warnings" Height="358" Width="623"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:views="clr-namespace:HashingTool.Views"
d:DataContext="{d:DesignInstance views:XMLValidationErrorsDialog}"
>
<Grid>
<ListBox x:Name="lbErrors" Margin="10,10,10,62" ItemsSource="{Binding XMLErrors}" />
<Button IsCancel="True" x:Name="btnClose" Content="Close" Margin="0,0,10,10" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" />
<Label x:Name="lblCount" HorizontalAlignment="Left" Margin="10,0,0,31" Width="340" Height="26" VerticalAlignment="Bottom">
<Label.Content>
<TextBlock Text="{Binding XMLErrors.Count, StringFormat='{}{0} Warnings/Errors'}" />
</Label.Content>
<Label.Style>
<Style TargetType="Label">
<Setter Property="Foreground" Value="Red" />
<Style.Triggers>
<DataTrigger Binding="{Binding XMLErrors.Count}" Value="0">
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
</Grid>
</Window>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;
using HashingTool.ViewModel.UserControl;
namespace HashingTool.Views
{
/// <summary>
/// Interaction logic for XMLValidationErrorsDialog.xaml
/// </summary>
public partial class XMLValidationErrorsDialog : Window
{
public static readonly DependencyProperty XMLErrorsProperty = DependencyProperty.Register("XMLErrors",
typeof(ObservableCollection<string>),
typeof(XMLValidationErrorsDialog));
public XMLValidationErrorsDialog()
{
InitializeComponent();
(Content as FrameworkElement).DataContext = this;
}
public ObservableCollection<string> XMLErrors
{
get { return (ObservableCollection<string>)GetValue(XMLErrorsProperty); }
set { SetValue(XMLErrorsProperty, value); }
}
}
}
......@@ -26,48 +26,65 @@
<local:VectoXMLFileSelector Margin="0,93,0,0" VerticalAlignment="Top" XMLFile="{Binding ComponentFile}" />
<Grid Height="425" VerticalAlignment="Top" Margin="15,141,5,0">
<Grid Margin="15,141,5,37">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Expander Grid.Row="0">
<Expander.Style>
<Style TargetType="Expander">
<Setter Property="IsEnabled" Value="True" />
<Setter Property="Foreground" Value="Red" />
<Style.Triggers>
<DataTrigger Binding="{Binding XMLValidationErrors.Count}" Value="0">
<Setter Property="IsExpanded" Value="False" />
<Setter Property="IsEnabled" Value="False" />
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
</Style.Triggers>
</Style>
</Expander.Style>
<Expander.Header>
<TextBlock Text="{Binding XMLValidationErrors.Count, StringFormat='{}{0} Warnings/Errors'}" />
</Expander.Header>
<Grid Background="#FFE5E5E5" Margin="10,0,8,0">
<ListBox Height="185" VerticalAlignment="Top" IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding XMLValidationErrors}" />
</Grid>
</Expander>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<Label>
<Label.Content>
<TextBlock Text="{Binding XMLValidationErrors.Count, StringFormat='{}{0} Warnings/Errors'}" />
</Label.Content>
<Label.Style>
<Style TargetType="Label">
<Setter Property="Foreground" Value="Red" />
<Style.Triggers>
<DataTrigger Binding="{Binding XMLValidationErrors.Count}" Value="0">
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
<Button Margin="10,0,0,0" Content="Details..." HorizontalAlignment="Left" Width="91" Click="Button_Click">
<Button.Style>
<Style TargetType="Button">
<Setter Property="IsEnabled" Value="True" />
<Style.Triggers>
<DataTrigger Binding="{Binding XMLValidationErrors.Count}" Value="0">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
<Grid Grid.Row="1" Margin="0,10,0,0">
<Label x:Name="lblDigestValue" Content="Digest Value:" HorizontalAlignment="Left" Margin="10,38,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.57,0.5" FontSize="16" />
<TextBox x:Name="tbDigestValue" Text="{Binding DigestValue}" HorizontalAlignment="Left" Margin="117,41,0,0"
VerticalAlignment="Top" RenderTransformOrigin="4.1,-2.1" Width="454" FontFamily="Courier New" FontWeight="Bold"
<TextBox x:Name="tbDigestValue" Text="{Binding DigestValue}" Margin="117,41,100,0"
VerticalAlignment="Top" RenderTransformOrigin="4.1,-2.1" FontFamily="Courier New" FontWeight="Bold"
FontSize="16" Foreground="#FF03932B" />
<Label Name="lblC14N" Content="Canonicalization:" HorizontalAlignment="Left" Margin="10,10,0,0"
VerticalAlignment="Top" />
<Label Name="lblC14NList"
Content="{Binding CanonicalizaitionMethods, Converter={StaticResource CollectionConverter}}"
HorizontalAlignment="Left" Margin="117,10,0,0" VerticalAlignment="Top"
Width="454" />
Margin="117,10,100,0" VerticalAlignment="Top" />
<Button Content="Copy" Margin="0,41,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="75"
Click="Button_Click_1">
<Button.Style>
<Style TargetType="Button">
<Setter Property="IsEnabled" Value="false" />
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="IsEnabled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
<Grid Grid.Row="2" Margin="0,10,0,0">
<ContentControl HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Top" Width="66" Height="64">
......@@ -77,12 +94,15 @@
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="" />
<Setter Property="ToolTip" Value=""/>
<Style.Triggers>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="True">
<Setter Property="Content" Value="{StaticResource Icon_OK}" />
<Setter Property="ToolTip" Value="Component data validates against schema"/>
</DataTrigger>
<DataTrigger Binding="{Binding ComponentDataValid}" Value="False">
<Setter Property="Content" Value="{StaticResource Icon_NOK}" />
<Setter Property="ToolTip" Value="Component data does NOT validat against schema"/>
</DataTrigger>
</Style.Triggers>
</Style>
......@@ -91,7 +111,8 @@
</Grid>
</Grid>
<Label x:Name="lblFileSelect" Content="Component data:" HorizontalAlignment="Left" Margin="10,75,0,0" VerticalAlignment="Top"/>
<Label x:Name="lblFileSelect" Content="Component data:" HorizontalAlignment="Left" Margin="10,75,0,0"
VerticalAlignment="Top" />
</Grid>
</UserControl>
\ No newline at end of file
......@@ -18,5 +18,18 @@ namespace HashingTool.Views
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var dialog = new XMLValidationErrorsDialog();
dialog.XMLErrors = (DataContext as HashComponentDataViewModel).XMLValidationErrors;
dialog.ShowDialog();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Clipboard.SetText(tbDigestValue.Text);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment