Importdialog geradegezogen

This commit is contained in:
Daniel Schick 2022-06-17 09:02:59 +02:00
parent 77ae4a7c40
commit ab357ff88d
7 changed files with 68 additions and 13 deletions

View File

@ -821,6 +821,8 @@
<Resource Include="Resources\Logo.gif" /> <Resource Include="Resources\Logo.gif" />
<Resource Include="Resources\excel.png" /> <Resource Include="Resources\excel.png" />
<Resource Include="Resources\logo_eni.png" /> <Resource Include="Resources\logo_eni.png" />
<Resource Include="Resources\import1.png" />
<Resource Include="Resources\import2.png" />
<Content Include="x64\SQLite.Interop.dll"> <Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>

View File

@ -8,28 +8,36 @@
xmlns:p="clr-namespace:ENI2.Properties" xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" mc:Ignorable="d"
Title="{x:Static p:Resources.textCompareExcel}" Height="200" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_grey.ico"> Title="{x:Static p:Resources.textCompareExcel}" Height="260" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_grey.ico">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="32" />
<RowDefinition Height="60" /> <RowDefinition Height="60" />
<RowDefinition Height="60" /> <RowDefinition Height="60" />
<RowDefinition Height="28" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="80" /> <ColumnDefinition Width="80" />
<ColumnDefinition Width="60" /> <ColumnDefinition Width="80" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label VerticalAlignment="Center" Grid.Row="0" Grid.Column="0"> <TextBlock Grid.Row="0" Grid.Column="1" TextWrapping="Wrap" HorizontalAlignment="Center" TextAlignment="Center">Drop your Excel file here</TextBlock>
<Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="0">
<AccessText TextWrapping="Wrap"> <AccessText TextWrapping="Wrap">
First (original) sheet First (original) sheet
</AccessText> </AccessText>
</Label> </Label>
<Image x:Name="imageSource" Grid.Row="0" Grid.Column="1" Margin="2" Source="../Resources/trafficlight_off.png" AllowDrop="True" Drop="imageSource_Drop" DragEnter="imageSource_DragEnter"/> <Image x:Name="imageSource" Grid.Row="1" Grid.Column="1" Margin="4" Source="../Resources/import2.png" AllowDrop="True" Drop="imageSource_Drop" DragEnter="imageSource_DragEnter"/>
<Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="0"> <TextBox TextWrapping="Wrap" x:Name="textBoxSource" Grid.Row="1" Grid.Column="2" IsReadOnly="True" Margin="2" Drop="imageSource_Drop" AllowDrop="True" DragEnter="imageSource_DragEnter"/>
<Label VerticalAlignment="Center" Grid.Row="2" Grid.Column="0">
<AccessText TextWrapping="Wrap"> <AccessText TextWrapping="Wrap">
Second (updated) sheet Second (updated) sheet
</AccessText> </AccessText>
</Label> </Label>
<Image x:Name="imageTarget" Grid.Row="1" Grid.Column="1" Margin="2" Source="../Resources/trafficlight_off.png" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter"/> <Image x:Name="imageTarget" Grid.Row="2" Grid.Column="1" Margin="4" Source="../Resources/import1.png" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter"/>
<TextBox TextWrapping="Wrap" x:Name="textBoxTarget" Grid.Row="2" Grid.Column="2" IsReadOnly="True" Margin="2" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter"/>
<Button x:Name="buttonCompare" Margin="2" Grid.Row="3" Grid.Column="1" Content="Compare" IsEnabled="False" Click="buttonCompare_Click"/>
</Grid> </Grid>
</enictrl:StatusWindowBase> </enictrl:StatusWindowBase>

View File

@ -30,17 +30,20 @@ namespace ENI2.EditControls
if(files[0].EndsWith("xls") || files[0].EndsWith("xlsx")) if(files[0].EndsWith("xls") || files[0].EndsWith("xlsx"))
{ {
_sourcePath = files[0]; _sourcePath = files[0];
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_green.png")); textBoxSource.Text = _sourcePath;
} }
else else
{ {
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_yellow.png")); textBoxSource.Text = null;
_sourcePath = null;
} }
} }
else else
{ {
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_red.png")); textBoxSource.Text = null;
_sourcePath = null;
} }
EnableCompareButton();
} }
} }
@ -56,23 +59,39 @@ namespace ENI2.EditControls
if (files[0].EndsWith("xls") || files[0].EndsWith("xlsx")) if (files[0].EndsWith("xls") || files[0].EndsWith("xlsx"))
{ {
_targetPath = files[0]; _targetPath = files[0];
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_green.png")); textBoxTarget.Text = _targetPath;
} }
else else
{ {
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_yellow.png")); _targetPath = null;
textBoxTarget.Text = null;
} }
} }
else else
{ {
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_red.png")); _targetPath = null;
textBoxTarget.Text = null;
} }
EnableCompareButton();
} }
} }
private void imageSource_DragEnter(object sender, DragEventArgs e) private void imageSource_DragEnter(object sender, DragEventArgs e)
{ {
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effects = DragDropEffects.Copy; if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effects = DragDropEffects.Copy;
}
}
private void EnableCompareButton()
{
this.buttonCompare.IsEnabled = (_targetPath != null) && (_sourcePath != null);
}
private void buttonCompare_Click(object sender, RoutedEventArgs e)
{
} }
} }
} }

View File

@ -500,6 +500,26 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap import1 {
get {
object obj = ResourceManager.GetObject("import1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap import2 {
get {
object obj = ResourceManager.GetObject("import2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View File

@ -1843,4 +1843,10 @@
<data name="textCompareExcel" xml:space="preserve"> <data name="textCompareExcel" xml:space="preserve">
<value>Compare excel sheets</value> <value>Compare excel sheets</value>
</data> </data>
<data name="import1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\import1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="import2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\import2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

BIN
ENI2/Resources/import1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
ENI2/Resources/import2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB