Updateabgleich Dialogbox Teil 1

This commit is contained in:
Daniel Schick 2022-06-16 13:24:40 +02:00
parent 4bbaa1db08
commit 77ae4a7c40
7 changed files with 158 additions and 7 deletions

View File

@ -228,6 +228,9 @@
<Compile Include="Controls\LocodeControl.xaml.cs"> <Compile Include="Controls\LocodeControl.xaml.cs">
<DependentUpon>LocodeControl.xaml</DependentUpon> <DependentUpon>LocodeControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="EditControls\CompareExcelDialog.xaml.cs">
<DependentUpon>CompareExcelDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\EditWasteReceiptDialog.xaml.cs"> <Compile Include="EditControls\EditWasteReceiptDialog.xaml.cs">
<DependentUpon>EditWasteReceiptDialog.xaml</DependentUpon> <DependentUpon>EditWasteReceiptDialog.xaml</DependentUpon>
</Compile> </Compile>
@ -532,6 +535,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="EditControls\CompareExcelDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\CopyDeclarationDialog.xaml"> <Page Include="EditControls\CopyDeclarationDialog.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@ -777,10 +784,10 @@
<None Include="Resources\lightbulb_on.png" /> <None Include="Resources\lightbulb_on.png" />
<None Include="Resources\rotate_left.png" /> <None Include="Resources\rotate_left.png" />
<Resource Include="Resources\sign_warning.png" /> <Resource Include="Resources\sign_warning.png" />
<None Include="Resources\trafficlight_green.png" /> <Resource Include="Resources\trafficlight_green.png" />
<None Include="Resources\trafficlight_off.png" /> <Resource Include="Resources\trafficlight_off.png" />
<None Include="Resources\trafficlight_red.png" /> <Resource Include="Resources\trafficlight_red.png" />
<None Include="Resources\trafficlight_yellow.png" /> <Resource Include="Resources\trafficlight_yellow.png" />
<None Include="Resources\user_edit.png" /> <None Include="Resources\user_edit.png" />
<Resource Include="Resources\delete2.png" /> <Resource Include="Resources\delete2.png" />
<None Include="Resources\mail_new.png" /> <None Include="Resources\mail_new.png" />

View File

@ -0,0 +1,35 @@
<enictrl:StatusWindowBase x:Class="ENI2.EditControls.CompareExcelDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textCompareExcel}" Height="200" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_grey.ico">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="60" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition Width="60" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label VerticalAlignment="Center" Grid.Row="0" Grid.Column="0">
<AccessText TextWrapping="Wrap">
First (original) sheet
</AccessText>
</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"/>
<Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="0">
<AccessText TextWrapping="Wrap">
Second (updated) sheet
</AccessText>
</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"/>
</Grid>
</enictrl:StatusWindowBase>

View File

@ -0,0 +1,78 @@
using System;
using System.IO;
using System.Windows;
using System.Windows.Media.Imaging;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for CompareExcelDialog.xaml
/// </summary>
public partial class CompareExcelDialog : Controls.StatusWindowBase
{
private string _sourcePath = null;
private string _targetPath = null;
public CompareExcelDialog()
{
InitializeComponent();
}
private void imageSource_Drop(object sender, DragEventArgs e)
{
string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
Console.WriteLine(file);
if(files.Length > 0)
{
if(File.Exists(files[0]))
{
if(files[0].EndsWith("xls") || files[0].EndsWith("xlsx"))
{
_sourcePath = files[0];
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_green.png"));
}
else
{
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_yellow.png"));
}
}
else
{
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_red.png"));
}
}
}
private void imageTarget_Drop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
Console.WriteLine(file);
if (files.Length > 0)
{
if (File.Exists(files[0]))
{
if (files[0].EndsWith("xls") || files[0].EndsWith("xlsx"))
{
_targetPath = files[0];
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_green.png"));
}
else
{
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_yellow.png"));
}
}
else
{
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_red.png"));
}
}
}
private void imageSource_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effects = DragDropEffects.Copy;
}
}
}

View File

@ -72,6 +72,7 @@
<ColumnDefinition Width="auto"/> <ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/> <ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/> <ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -84,7 +85,8 @@
<RadioButton Grid.Column="3" x:Name="buttonStatus" Content="{x:Static p:Resources.textServerStatus}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Margin="2,5,0,0" Grid.RowSpan="2" /> <RadioButton Grid.Column="3" x:Name="buttonStatus" Content="{x:Static p:Resources.textServerStatus}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Margin="2,5,0,0" Grid.RowSpan="2" />
<RadioButton Grid.Column="4" x:Name="buttonUserAdmin" Content="{x:Static p:Resources.textUserAdministration}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0" Grid.RowSpan="2"/> <RadioButton Grid.Column="4" x:Name="buttonUserAdmin" Content="{x:Static p:Resources.textUserAdministration}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0" Grid.RowSpan="2"/>
<RadioButton Grid.Column="5" x:Name="buttonPOListe" Content="{x:Static p:Resources.textPOLists}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0" Grid.RowSpan="2" /> <RadioButton Grid.Column="5" x:Name="buttonPOListe" Content="{x:Static p:Resources.textPOLists}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0" Grid.RowSpan="2" />
<Button Grid.Column="5" x:Name="buttonAbout" Content="?" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Transparent" Margin="0,2,2,0" Padding="5,0,5,0" Click="buttonAbout_Click" Grid.RowSpan="2"/> <Button Grid.Column="6" x:Name="buttonCompareSheets" Content="{x:Static p:Resources.textCompareExcel}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="buttonCompareSheets_Click" Background="Transparent" Margin="2,2,0,0" />
<Button Grid.Column="7" x:Name="buttonAbout" Content="?" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Transparent" Margin="0,2,2,0" Padding="5,0,5,0" Click="buttonAbout_Click" Grid.RowSpan="2"/>
<Label Grid.Column="0" Grid.Row="1" x:Name="labelStatusId" Grid.ColumnSpan="3" Margin="2,2,0,0" HorizontalAlignment="Left"/> <Label Grid.Column="0" Grid.Row="1" x:Name="labelStatusId" Grid.ColumnSpan="3" Margin="2,2,0,0" HorizontalAlignment="Left"/>
</Grid> </Grid>
</Grid> </Grid>

View File

@ -38,6 +38,7 @@ namespace ENI2
private POListControl poControl; private POListControl poControl;
private ServerStatusControl statusControl; private ServerStatusControl statusControl;
private readonly SucheControl sucheControl; private readonly SucheControl sucheControl;
private CompareExcelDialog compareExcelDialog;
private bool efMode = false; private bool efMode = false;
private bool dbConnected; private bool dbConnected;
@ -287,6 +288,22 @@ namespace ENI2
this.buttonNewWithId.Visibility = newButtonsVisible ? Visibility.Visible : Visibility.Hidden; this.buttonNewWithId.Visibility = newButtonsVisible ? Visibility.Visible : Visibility.Hidden;
} }
private void buttonCompareSheets_Click(object sender, RoutedEventArgs ev)
{
// Open compare dialog
if(compareExcelDialog == null)
{
this.compareExcelDialog = new CompareExcelDialog();
this.compareExcelDialog.Closed += (o, e) => this.compareExcelDialog = null;
compareExcelDialog.Show();
}
else
{
compareExcelDialog.BringUp();
}
}
#endregion #endregion
#region window lifetime event handler #region window lifetime event handler

View File

@ -1345,6 +1345,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Compare excel sheets.
/// </summary>
public static string textCompareExcel {
get {
return ResourceManager.GetString("textCompareExcel", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Condition. /// Looks up a localized string similar to Condition.
/// </summary> /// </summary>

View File

@ -1840,4 +1840,7 @@
<data name="textCopyTo" xml:space="preserve"> <data name="textCopyTo" xml:space="preserve">
<value>Copy to {0}</value> <value>Copy to {0}</value>
</data> </data>
<data name="textCompareExcel" xml:space="preserve">
<value>Compare excel sheets</value>
</data>
</root> </root>