Compare commits

..

2 Commits

Author SHA1 Message Date
d43633cb65 Add Setup Project 2023-07-20 19:34:28 +02:00
cf1b1f7865 Update AreaComAdminWindow 2023-07-20 19:31:59 +02:00
17 changed files with 461 additions and 360 deletions

View File

@@ -4,22 +4,70 @@ VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elwig", "Elwig\Elwig.csproj", "{00868460-16F6-4B48-AA9B-998F6263693B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}"
EndProject
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "Setup", "Setup\Setup.wixproj", "{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{00868460-16F6-4B48-AA9B-998F6263693B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Debug|ARM64.Build.0 = Debug|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Debug|x64.ActiveCfg = Debug|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Debug|x64.Build.0 = Debug|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Debug|x86.ActiveCfg = Debug|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Debug|x86.Build.0 = Debug|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Release|Any CPU.Build.0 = Release|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Release|ARM64.ActiveCfg = Release|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Release|ARM64.Build.0 = Release|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Release|x64.ActiveCfg = Release|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Release|x64.Build.0 = Release|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Release|x86.ActiveCfg = Release|Any CPU
{00868460-16F6-4B48-AA9B-998F6263693B}.Release|x86.Build.0 = Release|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Debug|ARM64.Build.0 = Debug|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Debug|x64.ActiveCfg = Debug|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Debug|x64.Build.0 = Debug|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Debug|x86.ActiveCfg = Debug|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Debug|x86.Build.0 = Debug|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Release|Any CPU.Build.0 = Release|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Release|ARM64.ActiveCfg = Release|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Release|ARM64.Build.0 = Release|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Release|x64.ActiveCfg = Release|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Release|x64.Build.0 = Release|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Release|x86.ActiveCfg = Release|Any CPU
{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}.Release|x86.Build.0 = Release|Any CPU
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Debug|Any CPU.ActiveCfg = Debug|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Debug|Any CPU.Build.0 = Debug|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Debug|ARM64.ActiveCfg = Debug|ARM64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Debug|ARM64.Build.0 = Debug|ARM64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Debug|x64.ActiveCfg = Debug|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Debug|x64.Build.0 = Debug|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Debug|x86.ActiveCfg = Debug|x86
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Debug|x86.Build.0 = Debug|x86
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|Any CPU.ActiveCfg = Release|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|Any CPU.Build.0 = Release|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|ARM64.ActiveCfg = Release|ARM64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|ARM64.Build.0 = Release|ARM64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|x64.ActiveCfg = Release|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|x64.Build.0 = Release|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|x86.ActiveCfg = Release|x86
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -60,6 +60,12 @@
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="WineAttributeTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" MinWidth="150" Margin="0,0,10,0"/>
</StackPanel>
</DataTemplate>
<ControlTemplate x:Key="WineQualityLevelTemplateSimple">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}"/>

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>

View File

@@ -15,5 +15,8 @@ namespace Elwig.Models {
[Column("active")]
public bool IsActive { get; set; }
public override string ToString() {
return Name;
}
}
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->

View File

@@ -5,7 +5,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows"
mc:Ignorable="d"
Title="Flächenbindugen - Elwig" Height="500" Width="950"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Flächenbindugen - Elwig" Height="480" Width="745"
Loaded="Window_Loaded">
<Window.Resources>
<Style TargetType="Label">
@@ -30,6 +31,13 @@
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style TargetType="xctk:CheckComboBox">
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Height" Value="25"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style TargetType="Button">
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="9,3"/>
@@ -39,78 +47,53 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="19"/>
<RowDefinition Height="120"/>
<RowDefinition Height="190"/>
<RowDefinition Height="110"/>
<RowDefinition Height="175"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="620"/>
<ColumnDefinition Width="415"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Menu Grid.ColumnSpan="3" BorderThickness="0,0,0,1" BorderBrush="LightGray" Background="White">
<Menu Grid.ColumnSpan="2" BorderThickness="0,0,0,1" BorderBrush="LightGray" Background="White">
<MenuItem Header="Flächenbindugen"/>
</Menu>
<Grid Grid.RowSpan="4" Grid.Row="1">
<Grid Grid.RowSpan="3" Grid.Row="1" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="125"/>
<ColumnDefinition Width="125"/>
<ColumnDefinition Width="125"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<DataGrid x:Name="ContractList" AutoGenerateColumns="False" HeadersVisibility="Column" IsReadOnly="True" GridLinesVisibility="None" SelectionMode="Single"
CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False" SelectionChanged="ContractList_SelectionChanged" Grid.Column="0" Grid.Row="1"
Margin="10,10,5,47" FontSize="14" Grid.ColumnSpan="2" Background="#e2e2e2">
<DataGrid.Columns>
<DataGridTextColumn Header="VNr." Binding="{Binding VNr}" Width="*"/>
<DataGridTextColumn Header="Von" Binding="{Binding YearFrom}" Width="*"/>
<DataGridTextColumn Header="Bis" Binding="{Binding YearTo}" Width="*"/>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="NewContractButton" Content="Neu" Click="NewContractButton_Click"
HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,10,0,10" Width="110" Grid.Column="0"/>
<Button x:Name="DeleteContractButton" Content="Löschen" Click="DeleteContractButton_Click" IsEnabled="False"
HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5,10,0,10" Width="110" Grid.Column="1"/>
<Button x:Name="ContractSaveButton" Content="Speichern" Click="ContractSaveButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,10,0,10" Width="110" Grid.Column="0"/>
<Button x:Name="ContractCancelButton" Content="Abbrechen" Click="ContractCancelButton_Click" IsEnabled="False" Visibility="Hidden" IsCancel="True"
HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5,10,0,10" Width="110" Grid.Column="1"/>
<Button x:Name="NewAreaCommitmentButton" Content="Neu" Click="NewAreaCommitmentButton_Click" IsEnabled="False"
HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5,10,0,10" Width="110" Grid.Column="2"/>
<Button x:Name="EditAreaCommitmentButton" Content="Bearbeiten" Click="EditAreaCommitmentButton_Click" IsEnabled="False"
HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="-5,10,0,10" Width="110" Grid.Column="3"/>
<Button x:Name="DeleteAreaCommitmentButton" Content="Löschen" Click="DeleteAreaCommitmentButton_Click" IsEnabled="False"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,10,10,10" Width="110" Grid.Column="4"/>
<Button x:Name="AreaCommitmentSaveButton" Content="Speichern" Click="AreaCommitmentSaveButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,10,0,10" Width="110" Grid.Column="2"/>
<Button x:Name="AreaCommitmentResetButton" Content="Zurücksetzen" Click="AreaCommitmentResetButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="-5,10,0,10" Width="110" Grid.Column="3"/>
<Button x:Name="AreaCommitmentCancelButton" Content="Abbrechen" Click="AreaCommitmentCancelButton_Click" IsEnabled="False" Visibility="Hidden" IsCancel="True"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,10,10,10" Width="110" Grid.Column="4"/>
<DataGrid x:Name="AreaCommitmentList" AutoGenerateColumns="False" HeadersVisibility="Column" IsReadOnly="True" GridLinesVisibility="None" SelectionMode="Single"
CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False" SelectionChanged="AreaCommitmentList_SelectionChanged" Grid.Column="2" Grid.Row="1"
Margin="5,10,10,47" FontSize="14" Grid.ColumnSpan="3" Background="#e2e2e2">
CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False" SelectionChanged="AreaCommitmentList_SelectionChanged" Grid.Column="0" Grid.Row="1"
Margin="5,10,5,47" FontSize="14" Grid.ColumnSpan="3" Background="#e2e2e2">
<DataGrid.Columns>
<DataGridTextColumn Header="Katastralgemeinde" Binding="{Binding Kg.Kg.Name}" Width="5*"/>
<DataGridTextColumn Header="FbNr" Binding="{Binding FbNr}" Width="2*"/>
<DataGridTextColumn Header="Katastralgemeinde" Binding="{Binding Kg.AtKg.Name}" Width="5*"/>
<DataGridTextColumn Header="Ried" Binding="{Binding Rd.Name}" Width="4*"/>
<DataGridTextColumn Header="Parzelle" Binding="{Binding GstNr}" Width="4*"/>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="NewAreaCommitmentButton" Content="Neu" Click="NewAreaCommitmentButton_Click"
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,10,5,10" Grid.Column="0"/>
<Button x:Name="EditAreaCommitmentButton" Content="Bearbeiten" Click="EditAreaCommitmentButton_Click" IsEnabled="False"
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,10,5,10" Grid.Column="1"/>
<Button x:Name="DeleteAreaCommitmentButton" Content="Löschen" Click="DeleteAreaCommitmentButton_Click" IsEnabled="False"
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,10,5,10" Grid.Column="2"/>
<Button x:Name="AreaCommitmentSaveButton" Content="Speichern" Click="AreaCommitmentSaveButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,10,5,10" Grid.Column="0"/>
<Button x:Name="AreaCommitmentResetButton" Content="Zurücksetzen" Click="AreaCommitmentResetButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,10,5,10" Grid.Column="1"/>
<Button x:Name="AreaCommitmentCancelButton" Content="Abbrechen" Click="AreaCommitmentCancelButton_Click" IsEnabled="False" Visibility="Hidden" IsCancel="True"
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,10,5,10" Grid.Column="2"/>
</Grid>
<GroupBox Header="Vertrag" Grid.Column="1" Grid.Row="1" Grid.RowSpan="1" Margin="5,5,5,5">
<GroupBox Header="Vertrag" Grid.Column="2" Grid.Row="1" Grid.RowSpan="1" Margin="5,5,5,5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
@@ -119,24 +102,24 @@
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<Label Content="VNr.:" Margin="10,10,0,0" Grid.Column="0"/>
<TextBox x:Name="VNrInput" Margin="0,10,0,0" Width="48" Grid.Column="1" TextAlignment="Right" HorizontalAlignment="Left"
TextChanged="VNrInput_TextChanged" LostFocus="VNrInput_LostFocus"/>
<Label Content="FbNr.:" Margin="10,10,0,0" Grid.Column="0"/>
<TextBox x:Name="FbNrInput" Margin="0,10,0,0" Width="48" Grid.Column="1" TextAlignment="Right" HorizontalAlignment="Left"
TextChanged="FbNrInput_TextChanged" LostFocus="FbNrInput_LostFocus"/>
<Label Content="MgNr.:" Margin="10,40,0,0" Grid.Column="0"/>
<TextBox x:Name="MgNrInput" Margin="0,40,0,0" Width="48" Grid.Column="1" TextAlignment="Right" HorizontalAlignment="Left"/>
<Label Content="Von:" Margin="10,10,0,0" Grid.Column="2"/>
<TextBox x:Name="YearFromInput" Margin="0,10,0,0" Width="100" Grid.Column="3" TextAlignment="Right" HorizontalAlignment="Left"
TextChanged="YearFromInput_TextChanged"/>
TextChanged="IntegerInput_TextChanged"/>
<Label Content="Bis:" Margin="10,40,0,0" Grid.Column="2"/>
<TextBox x:Name="YearToInput" Margin="0,40,0,0" Width="100" Grid.Column="3" TextAlignment="Right" HorizontalAlignment="Left"
TextChanged="YearToInput_TextChanged"/>
TextChanged="IntegerInput_TextChanged"/>
</Grid>
</GroupBox>
<GroupBox Header="Lage" Grid.Column="1" Grid.Row="2" Grid.RowSpan="1" Margin="5,5,5,5">
<GroupBox Header="Lage" Grid.Column="2" Grid.Row="2" Grid.RowSpan="1" Margin="5,5,5,5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
@@ -147,24 +130,24 @@
<ComboBox x:Name="KgInput" ItemTemplate="{StaticResource KgNrTemplate}" TextSearch.TextPath="Name"
Width="200" HorizontalAlignment="Left" SelectionChanged="KgInput_SelectionChanged"
Margin="0,10,10,0" Grid.Column="1"/>
<Label Content="Ried:" Margin="10,40,0,0" Grid.Column="0"/>
<ComboBox x:Name="RdInput" DisplayMemberPath="Name" TextSearch.TextPath="Name"
Width="200" HorizontalAlignment="Left"
Margin="0,40,0,0" Grid.Column="1"/>
<Label Content="Parzelle:" Margin="10,70,0,0" Grid.Column="0"/>
<TextBox x:Name="GstNrInput" Margin="0,70,0,0" Width="100" Grid.Column="1" TextAlignment="Right" HorizontalAlignment="Left"
TextChanged="GstNrInput_TextChanged" LostFocus="GstNrInput_LostFocus"/>
<Label Content="Fläche (m²):" Margin="10,100,0,0" Grid.Column="0"/>
<TextBox x:Name="AreaInput" Margin="0,100,0,0" Width="100" Grid.Column="1" TextAlignment="Right" HorizontalAlignment="Left"
TextChanged="AreaInput_TextChanged"/>
TextChanged="IntegerInput_TextChanged"/>
</Grid>
</GroupBox>
<GroupBox Header="Eigenschaften" Grid.Column="1" Grid.Row="3" Grid.RowSpan="1" Margin="5,5,5,5">
<GroupBox Header="Eigenschaften" Grid.Column="2" Grid.Row="3" Grid.RowSpan="1" Margin="5,5,5,5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
@@ -172,20 +155,18 @@
</Grid.ColumnDefinitions>
<Label Content="Sorte:" Margin="10,10,0,0" Grid.Column="0"/>
<ComboBox x:Name="SortInput" ItemTemplate="{StaticResource WineVarietyTemplate}" TextSearch.TextPath="Name"
<ComboBox x:Name="WineVarietyInput" ItemTemplate="{StaticResource WineVarietyTemplate}" TextSearch.TextPath="Name"
Width="200" HorizontalAlignment="Left"
Margin="0,10,10,0" Grid.Column="1"/>
<Label Content="Attribut:" Margin="10,40,0,0" Grid.Column="0"/>
<ComboBox x:Name="AttrInput" DisplayMemberPath="Name" TextSearch.TextPath="Name"
Width="200" HorizontalAlignment="Left"
Margin="0,40,10,0" Grid.Column="1"/>
<Label Content="Attribute:" Margin="10,40,0,0" Grid.Column="0"/>
<xctk:CheckComboBox x:Name="AttributesInput" Grid.Column="1" Margin="0,40,0,0" IsEnabled="False"
ItemTemplate="{StaticResource WineAttributeTemplate}" Delimiter=", " AllItemsSelectedContent="Alle"
Width="200" HorizontalAlignment="Left" ItemSelectionChanged="AttributesInput_SelectionChanged"/>
<Label Content="Bewirt. Art:" Margin="10,70,0,0" Grid.Column="0"/>
<ComboBox x:Name="CultInput" DisplayMemberPath="Name" TextSearch.TextPath="Name"
Width="200" HorizontalAlignment="Left"
Margin="0,70,10,0" Grid.Column="1"/>
<ComboBox x:Name="WineCultivationInput" DisplayMemberPath="Name" TextSearch.TextPath="Name"
Width="200" HorizontalAlignment="Left" Margin="0,70,10,0" Grid.Column="1"/>
</Grid>
</GroupBox>
</Grid>

View File

@@ -4,8 +4,11 @@ using System.Windows;
using System.Windows.Controls;
using Elwig.Helpers;
using Elwig.Models;
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Xceed.Wpf.Toolkit.Primitives;
namespace Elwig.Windows {
public partial class AreaComAdminWindow : AdministrationWindow {
@@ -16,34 +19,18 @@ namespace Elwig.Windows {
Member = Context.Members.Find(mgnr) ?? throw new ArgumentException("MgNr argument has invalid value");
Title = $"Flächenbindungen - {Member.AdministrativeName} - Elwig";
ExemptInputs = new Control[] {
MgNrInput, ContractList, AreaCommitmentList, NewContractButton, DeleteContractButton,
ContractSaveButton, ContractCancelButton, NewAreaCommitmentButton,
MgNrInput, AreaCommitmentList, NewAreaCommitmentButton,
EditAreaCommitmentButton, DeleteAreaCommitmentButton, AreaCommitmentSaveButton,
AreaCommitmentResetButton, AreaCommitmentCancelButton
};
RequiredInputs = new Control[] {
VNrInput, YearFromInput, KgInput,
GstNrInput, AreaInput, SortInput, CultInput
FbNrInput, YearFromInput, KgInput,
GstNrInput, AreaInput, WineVarietyInput, WineCultivationInput
};
}
private async void Window_Loaded(object sender, RoutedEventArgs e) {
await RefreshContractList();
KgInput.ItemsSource = Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToList();
SortInput.ItemsSource = Context.WineVarieties.OrderBy(s => s.Name).ToList();
AttrInput.ItemsSource = Context.WineAttributes.OrderBy(a => a.Name).ToList();
CultInput.ItemsSource = Context.WineCultivations.OrderBy(c => c.Name).ToList();
}
protected override async Task RenewContext() {
await base.RenewContext();
}
private async Task RefreshContractList() {
/*
await Context.Contracts.LoadAsync();
await RefreshContractListQuery();
*/
await RenewContext();
}
private async Task RefreshAreaCommitmentList() {
@@ -51,51 +38,19 @@ namespace Elwig.Windows {
await RefreshAreaCommitmentListQuery();
}
private async Task RefreshContractListQuery() {
/*
List<Contract> contracts = await Context.Contracts.Where(c => c.MgNr == member.MgNr).ToListAsync();
ContractList.ItemsSource = contracts;
if (contracts.Count == 1)
ContractList.SelectedIndex = 0;
// TODO notwendig?
await RefreshAreaCommitmentList();
RefreshInputs();
*/
}
private async Task RefreshAreaCommitmentListQuery() {
/*
Contract? contract = (Contract)ContractList.SelectedItem;
if (contract == null) {
AreaCommitmentList.ItemsSource = null;
return;
}
List<AreaCom> areaComs = await Context.AreaCommitments.Where(a => a.MgNr == Member.MgNr).OrderBy(a => a.FbNr).ToListAsync();
List<AreaComParcel> parcels = (await Context.AreaCommitments.FindAsync(contract.VNr)).Parcels.ToList();
AreaCommitmentList.ItemsSource = parcels;
if (parcels.Count == 1)
Utils.RenewItemsSource(AreaCommitmentList, areaComs, i => (i as AreaCom)?.FbNr);
if (areaComs.Count == 1)
AreaCommitmentList.SelectedIndex = 0;
RefreshInputs();
*/
}
private void RefreshInputs(bool validate = false) {
/*
ClearInputStates();
Contract? c = (Contract)ContractList.SelectedItem;
AreaComParcel? a = (AreaComParcel)AreaCommitmentList.SelectedItem;
if (c != null) {
DeleteContractButton.IsEnabled = true;
NewAreaCommitmentButton.IsEnabled = true;
} else {
DeleteContractButton.IsEnabled = false;
NewAreaCommitmentButton.IsEnabled = false;
}
AreaCom? a = (AreaCom)AreaCommitmentList.SelectedItem;
if (a != null) {
EditAreaCommitmentButton.IsEnabled = true;
@@ -104,49 +59,64 @@ namespace Elwig.Windows {
} else {
EditAreaCommitmentButton.IsEnabled = false;
DeleteAreaCommitmentButton.IsEnabled = false;
ClearOriginalValues();
ClearInputs();
AttributesInput.UnSelectAll();
MgNrInput.Text = "";
}
if (!validate) ClearInputStates();
GC.Collect();
*/
}
/*
private void FillInputs(AreaComParcel a) {
private void FillInputs(AreaCom a) {
ClearOriginalValues();
VNrInput.Text = a.VNr.ToString();
MgNrInput.Text = a.AreaCom.Contract.MgNr.ToString();
YearFromInput.Text = a.AreaCom.Contract.YearFrom.ToString();
YearToInput.Text = a.AreaCom.Contract.YearTo.ToString();
FbNrInput.Text = a.FbNr.ToString();
MgNrInput.Text = a.MgNr.ToString();
YearFromInput.Text = a.YearFrom.ToString();
YearToInput.Text = a.YearTo.ToString();
KgInput.SelectedItem = a.Kg.Kg;
KgInput.SelectedItem = a.Kg.AtKg;
RdInput.SelectedItem = a.Rd;
GstNrInput.Text = a.GstNr;
AreaInput.Text = a.Area.ToString();
SortInput.SelectedItem = a.AreaCom.WineVar;
// FIXME
//AttrInput.SelectedItem = a.WineAttr;
CultInput.SelectedItem = a.AreaCom.WineCult;
WineVarietyInput.SelectedItem = a.WineVar;
AttributesInput.UnSelectAll();
foreach (var attr in a.Attributes) {
AttributesInput.SelectedItems.Add(attr);
}
WineCultivationInput.SelectedItem = a.WineCult;
FillOriginalValues();
}
*/
private async void InitInputs() {
FbNrInput.Text = (await Context.NextFbNr()).ToString();
MgNrInput.Text = Member.MgNr.ToString();
FillOriginalValues();
ValidateRequiredInputs();
}
protected override async Task RenewContext() {
await base.RenewContext();
Utils.RenewItemsSource(KgInput, await Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToListAsync(), i => (i as AT_Kg)?.KgNr);
Utils.RenewItemsSource(WineVarietyInput, await Context.WineVarieties.OrderBy(v => v.Name).ToListAsync(), i => (i as WineVar)?.SortId);
Utils.RenewItemsSource(AttributesInput, await Context.WineAttributes.OrderBy(a => a.Name).ToListAsync(), i => (i as WineAttr)?.AttrId);
Utils.RenewItemsSource(WineCultivationInput, await Context.WineCultivations.OrderBy(c => c.Name).ToListAsync(), i => (i as WineCult)?.CultId);
await RefreshAreaCommitmentList();
}
private void NewAreaCommitmentButton_Click(object sender, RoutedEventArgs evt) {
IsCreating = true;
AreaCommitmentList.IsEnabled = false;
AreaCommitmentList.SelectedItem = null;
ContractList.IsEnabled = false;
HideAreaCommitmentNewEditDeleteButtons();
ShowAreaCommitmentSaveResetCancelButtons();
DisableContractNewDeleteButtons();
UnlockInputs();
VNrInput.IsReadOnly = true;
YearFromInput.IsReadOnly = true;
YearToInput.IsReadOnly = true;
AttributesInput.IsEnabled = true;
InitInputs();
}
@@ -156,111 +126,73 @@ namespace Elwig.Windows {
IsEditing = true;
AreaCommitmentList.IsEnabled = false;
ContractList.IsEnabled = false;
HideAreaCommitmentNewEditDeleteButtons();
ShowAreaCommitmentSaveResetCancelButtons();
DisableContractNewDeleteButtons();
UnlockInputs();
AttributesInput.IsEnabled = true;
}
private async void DeleteAreaCommitmentButton_Click(object sender, RoutedEventArgs evt) {
/*
AreaComParcel a = (AreaComParcel)AreaCommitmentList.SelectedItem;
AreaCom a = (AreaCom)AreaCommitmentList.SelectedItem;
if (a == null) return;
var r = MessageBox.Show(
$"Soll die Parzelle {a.GstNr} ({a.Area} m²) wirklich unwiderruflich gelöscht werden?",
$"Soll die Flächenbindung {a.GstNr} ({a.Area} m²) wirklich unwiderruflich gelöscht werden?",
"Parzelle löschen", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
if (r == MessageBoxResult.Yes) {
Context.Remove(a);
Context.SaveChanges();
await RefreshAreaCommitmentList();
}
*/
}
private void NewContractButton_Click(object sender, RoutedEventArgs evt) {
IsCreating = true;
ContractList.IsEnabled = false;
ContractList.SelectedItem = null;
AreaCommitmentList.IsEnabled = false;
AreaCommitmentList.SelectedItem = null;
HideContractNewDeleteButtons();
ShowContractSaveCancelButtons();
DisableAreaCommitmentNewEditDeleteButtons();
UnlockInputs();
InitInputs();
}
private async void DeleteContractButton_Click(object sender, RoutedEventArgs evt) {
/*
Contract c = (Contract)ContractList.SelectedItem;
if (c == null) return;
var r = MessageBox.Show(
$"Soll der Vertrag {c.VNr} und alle enthaltenen Parzellen wirklich unwiderruflich gelöscht werden?",
"Vertrag löschen", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
if (r == MessageBoxResult.Yes) {
Context.Remove(c);
Context.SaveChanges();
await RefreshContractList();
}
*/
}
/*
private async Task<Contract> UpdateContract(Contract c) {
int newVNr = int.Parse(VNrInput.Text);
c.MgNr = int.Parse(MgNrInput.Text);
c.YearFrom = int.Parse(YearFromInput.Text);
c.YearTo = (YearToInput.Text == "") ? null : int.Parse(YearToInput.Text);
EntityEntry<Contract>? tr = null;
try {
if (IsEditing) {
tr = Context.Update(c);
} else if (IsCreating) {
c.VNr = newVNr;
tr = (await Context.AddAsync(c));
}
await Context.SaveChangesAsync();
if (newVNr != c.VNr) {
await Context.Database.ExecuteSqlAsync($"UPDATE contract SET vnr = {newVNr} WHERE mgnr = {c.VNr}");
await Context.Contracts.LoadAsync();
c = await Context.Contracts.FindAsync(newVNr);
}
} catch (Exception exc) {
if (tr != null) await tr.ReloadAsync();
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
MessageBox.Show(str, "Vertrag aktualisieren", MessageBoxButton.OK, MessageBoxImage.Error);
}
return c;
}
private async Task<AreaComParcel> UpdateaAreaComParcel(AreaComParcel a) {
a.VNr = int.Parse(VNrInput.Text);
private async Task<AreaCom> UpdateAreaCom(AreaCom a) {
int newFbNr = int.Parse(FbNrInput.Text);
a.MgNr = int.Parse(MgNrInput.Text);
a.YearFrom = int.Parse(YearFromInput.Text);
a.YearTo = (YearToInput.Text == "") ? null : int.Parse(YearToInput.Text);
a.KgNr = ((AT_Kg)KgInput.SelectedItem).KgNr;
a.RdNr = ((WbRd)RdInput.SelectedItem).RdNr;
a.RdNr = RdInput.SelectedItem.GetType() == typeof(NullItem) ? null : ((WbRd)RdInput.SelectedItem).RdNr;
a.GstNr = GstNrInput.Text;
a.Area = int.Parse(AreaInput.Text);
a.AreaCom.SortId = ((WineVar)SortInput.SelectedItem).SortId;
// FIXME
//a.AttrId = ((WineAttr)AttrInput.SelectedItem).AttrId;
a.AreaCom.CultId = ((WineCult)CultInput.SelectedItem).CultId;
a.SortId = ((WineVar)WineVarietyInput.SelectedItem).SortId;
a.CultId = ((WineCult)WineCultivationInput.SelectedItem).CultId;
EntityEntry<AreaComParcel>? tr = null;
EntityEntry<AreaCom>? tr = null;
try {
if (IsEditing) {
tr = Context.Update(a);
} else if (IsCreating) {
a.FbNr = newFbNr;
tr = (await Context.AddAsync(a));
}
foreach (WineAttr attr in a.Attributes) {
if (!AttributesInput.SelectedItems.Contains(attr)) {
var aca = a.AttributeEntries.FirstOrDefault(h => h.AttrId == attr.AttrId);
Context.Remove(aca);
}
}
foreach (WineAttr attr in AttributesInput.SelectedItems) {
if (!a.Attributes.Contains(attr)) {
AreaComAttr aca = Context.CreateProxy<AreaComAttr>();
aca.FbNr = a.FbNr;
aca.AttrId = attr.AttrId;
await Context.AddAsync(aca);
}
}
await Context.SaveChangesAsync();
if (newFbNr != a.FbNr) {
await Context.Database.ExecuteSqlAsync($"UPDATE area_commitment SET fbnr = {newFbNr} WHERE fbnr = {a.FbNr}");
await Context.Members.LoadAsync();
a = await Context.AreaCommitments.FindAsync(newFbNr);
}
} catch (Exception exc) {
if (tr != null) await tr.ReloadAsync();
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
@@ -270,26 +202,18 @@ namespace Elwig.Windows {
return a;
}
*/
private async void AreaCommitmentSaveButton_Click(object sender, RoutedEventArgs evt) {
/*
Contract c = await UpdateContract((Contract)ContractList.SelectedItem);
AreaComParcel a = await UpdateaAreaComParcel(IsEditing ? (AreaComParcel)AreaCommitmentList.SelectedItem : Context.CreateProxy<AreaComParcel>());
AreaCom a = await UpdateAreaCom(IsEditing ? (AreaCom)AreaCommitmentList.SelectedItem : Context.CreateProxy<AreaCom>());
IsEditing = false;
IsCreating = false;
AreaCommitmentList.IsEnabled = true;
ContractList.IsEnabled = true;
HideAreaCommitmentSaveResetCancelButtons();
ShowAreaCommitmentNewEditDeleteButtons();
EnableContractNewDeleteButtons();
LockInputs();
await RefreshContractList();
AttributesInput.IsEnabled = false;
await RefreshAreaCommitmentList();
ContractList.SelectedItem = c;
AreaCommitmentList.SelectedItem = a;
*/
}
private void AreaCommitmentResetButton_Click(object sender, RoutedEventArgs evt) {
@@ -305,73 +229,19 @@ namespace Elwig.Windows {
IsEditing = false;
IsCreating = false;
AreaCommitmentList.IsEnabled = true;
ContractList.IsEnabled = true;
HideAreaCommitmentSaveResetCancelButtons();
ShowAreaCommitmentNewEditDeleteButtons();
EnableContractNewDeleteButtons();
RefreshInputs();
ClearInputStates();
LockInputs();
}
private async void ContractSaveButton_Click(object sender, RoutedEventArgs evt) {
/*
Contract c = await UpdateContract(Context.CreateProxy<Contract>());
AreaComParcel a = await UpdateaAreaComParcel(Context.CreateProxy<AreaComParcel>());
IsEditing = false;
IsCreating = false;
AreaCommitmentList.IsEnabled = true;
ContractList.IsEnabled = true;
HideContractSaveCancelButtons();
ShowContractNewDeleteButtons();
EnableAreaCommitmentNewEditDeleteButtons();
LockInputs();
await RefreshContractList();
await RefreshAreaCommitmentList();
ContractList.SelectedItem = c;
AreaCommitmentList.SelectedItem = a;
*/
}
private void ContractCancelButton_Click(object sender, RoutedEventArgs evt) {
IsEditing = false;
IsCreating = false;
ContractList.IsEnabled = true;
AreaCommitmentList.IsEnabled = true;
HideContractSaveCancelButtons();
ShowContractNewDeleteButtons();
EnableAreaCommitmentNewEditDeleteButtons();
RefreshInputs();
ClearInputStates();
LockInputs();
AttributesInput.IsEnabled = false;
}
override protected void UpdateButtons() {
if (!IsEditing && !IsCreating) return;
bool ch = HasChanged, v = IsValid;
ContractSaveButton.IsEnabled = (v && ch);
AreaCommitmentResetButton.IsEnabled = (ch);
AreaCommitmentSaveButton.IsEnabled = (v && ch);
}
private async void InitInputs() {
/*
VNrInput.Text = ContractList.SelectedItem == null ? (await Context.NextVNr()).ToString() : ((Contract)ContractList.SelectedItem).VNr.ToString();
MgNrInput.Text = member.MgNr.ToString();
FillOriginalValues();
ValidateRequiredInputs();
*/
}
private void EnableContractNewDeleteButtons() {
NewContractButton.IsEnabled = true;
DeleteContractButton.IsEnabled = ContractList.SelectedItem != null;
}
private void DisableContractNewDeleteButtons() {
NewContractButton.IsEnabled = false;
DeleteContractButton.IsEnabled = false;
AreaCommitmentSaveButton.IsEnabled = (ch && v);
}
private void DisableAreaCommitmentNewEditDeleteButtons() {
@@ -381,37 +251,11 @@ namespace Elwig.Windows {
}
private void EnableAreaCommitmentNewEditDeleteButtons() {
NewAreaCommitmentButton.IsEnabled = ContractList.SelectedItem != null;
NewAreaCommitmentButton.IsEnabled = true;
EditAreaCommitmentButton.IsEnabled = AreaCommitmentList.SelectedItem != null;
DeleteAreaCommitmentButton.IsEnabled = AreaCommitmentList.SelectedItem != null;
}
private void ShowContractSaveCancelButtons() {
ContractSaveButton.IsEnabled = false;
ContractCancelButton.IsEnabled = true;
ContractSaveButton.Visibility = Visibility.Visible;
ContractCancelButton.Visibility = Visibility.Visible;
}
private void HideContractSaveCancelButtons() {
ContractSaveButton.IsEnabled = false;
ContractCancelButton.IsEnabled = false;
ContractSaveButton.Visibility = Visibility.Hidden;
ContractCancelButton.Visibility = Visibility.Hidden;
}
private void ShowContractNewDeleteButtons() {
EnableContractNewDeleteButtons();
NewContractButton.Visibility = Visibility.Visible;
DeleteContractButton.Visibility = Visibility.Visible;
}
private void HideContractNewDeleteButtons() {
DisableContractNewDeleteButtons();
NewContractButton.Visibility = Visibility.Hidden;
DeleteContractButton.Visibility = Visibility.Hidden;
}
private void ShowAreaCommitmentSaveResetCancelButtons() {
AreaCommitmentSaveButton.IsEnabled = false;
AreaCommitmentResetButton.IsEnabled = false;
@@ -444,57 +288,40 @@ namespace Elwig.Windows {
DeleteAreaCommitmentButton.Visibility = Visibility.Hidden;
}
private async void ContractList_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
//await RefreshContractListQuery();
await RefreshAreaCommitmentList();
}
private void AreaCommitmentList_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
RefreshInputs();
}
private void KgInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
private void AttributesInput_SelectionChanged(object sender, ItemSelectionChangedEventArgs evt) {
}
private async void KgInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
AT_Kg? curr_kg = (AT_Kg)KgInput.SelectedItem;
if (curr_kg != null) {
RdInput.ItemsSource = Context.WbRde.Where(r => r.KgNr == curr_kg.KgNr).OrderBy(r => r.Name).ToList();
var rdList = await Context.WbRde.Where(r => r.KgNr == curr_kg.KgNr).OrderBy(r => r.Name).Cast<object>().ToListAsync();
rdList.Insert(0, new NullItem());
Utils.RenewItemsSource(RdInput, rdList, i => (i as WbRd)?.RdNr);
}
ComboBox_SelectionChanged(sender, evt);
}
/*
protected void InputTextChanged(TextBox input, Func<TextBox, bool, AppDbContext, Contract?, ValidationResult> checker) {
InputTextChanged(input, checker(input, SenderIsRequired(input), Context, (Contract)ContractList.SelectedItem));
protected void InputTextChanged(TextBox input, Func<TextBox, bool, AppDbContext, AreaCom?, ValidationResult> checker) {
InputTextChanged(input, checker(input, SenderIsRequired(input), Context, (AreaCom)AreaCommitmentList.SelectedItem));
}
protected void InputLostFocus(TextBox input, Func<TextBox, bool, AppDbContext, Contract?, ValidationResult> checker, string? msg = null) {
InputLostFocus(input, checker(input, SenderIsRequired(input), Context, (Contract)ContractList.SelectedItem), msg);
}
*/
private void NumericInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckInteger);
protected void InputLostFocus(TextBox input, Func<TextBox, bool, AppDbContext, AreaCom?, ValidationResult> checker, string? msg = null) {
InputLostFocus(input, checker(input, SenderIsRequired(input), Context, (AreaCom)AreaCommitmentList.SelectedItem), msg);
}
private void VNrInput_TextChanged(object sender, RoutedEventArgs evt) {
/*
InputTextChanged((TextBox)sender, Validator.CheckVNr);
*/
private void FbNrInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckFbNr);
}
private void VNrInput_LostFocus(object sender, RoutedEventArgs evt) {
/*
InputLostFocus((TextBox)sender, Validator.CheckVNr);
*/
private void FbNrInput_LostFocus(object sender, RoutedEventArgs evt) {
InputLostFocus((TextBox)sender, Validator.CheckFbNr);
}
private void YearFromInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckInteger);
}
private void YearToInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckInteger);
}
private void GstNrInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckGstNr);
}
@@ -502,9 +329,5 @@ namespace Elwig.Windows {
private void GstNrInput_LostFocus(object sender, RoutedEventArgs evt) {
InputLostFocus((TextBox)sender, Validator.CheckGstNr);
}
private void AreaInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckInteger);
}
}
}

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wix="http://wixtoolset.org/schemas/v4/wxs"
xmlns="http://wixtoolset.org/schemas/v4/wxs"
version="1.0"
exclude-result-prefixes="xsl wix">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:strip-space elements="*" />
<!--
Find all <Component> elements with <File> elements with Source="" attributes ending in ".exe" and tag it with the "ExeToRemove" key.
<Component Id="cmpSYYKP6B1M7WSD5KLEQ7PZW4YLOPYG61L" Directory="INSTALLDIR" Guid="*">
<File Id="filKUS7ZRMJ0AOKDU6ATYY6IRUSR2ECPDFO" KeyPath="yes" Source="!(wix.StagingAreaPath)\ProofOfPEqualsNP.exe" />
</Component>
Because WiX's Heat.exe only supports XSLT 1.0 and not XSLT 2.0 we cannot use `ends-with( haystack, needle )` (e.g. `ends-with( wix:File/@Source, '.exe' )`...
...but we can use this longer `substring` expression instead (see https://github.com/wixtoolset/issues/issues/5609 )
-->
<xsl:key
name="ExeToRemove"
match="wix:Component[ substring( wix:File/@Source, string-length( wix:File/@Source ) - 3 ) = '.exe' ]"
use="@Id"
/>
<!-- Get the last 4 characters of a string using `substring( s, len(s) - 3 )`, it uses -3 and not -4 because XSLT uses 1-based indexes, not 0-based indexes. -->
<!-- We can also remove .pdb files too, for example: -->
<xsl:key
name="PdbToRemove"
match="wix:Component[ substring( wix:File/@Source, string-length( wix:File/@Source ) - 3 ) = '.pdb' ]"
use="@Id"
/>
<!-- By default, copy all elements and nodes into the output... -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<!-- ...but if the element has the "ExeToRemove" key then don't render anything (i.e. removing it from the output) -->
<xsl:template match="*[ self::wix:Component or self::wix:ComponentRef ][ key( 'ExeToRemove', @Id ) ]" />
<xsl:template match="*[ self::wix:Component or self::wix:ComponentRef ][ key( 'PdbToRemove', @Id ) ]" />
</xsl:stylesheet>

View File

@@ -0,0 +1,12 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<ComponentGroup Id="DocumentTemplateComponents" Directory="ConfigFolderResources">
<Component>
<File Source="$(TargetDir)\paged.polyfill.js" />
</Component>
<Component>
<File Source="$(var.Elwig.ProjectDir)\Documents\style.css" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wix="http://wixtoolset.org/schemas/v4/wxs"
xmlns="http://wixtoolset.org/schemas/v4/wxs"
version="1.0"
exclude-result-prefixes="xsl wix">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:strip-space elements="*" />
<!--
Find all <Component> elements with <File> elements with Source="" attributes ending in ".exe" and tag it with the "ExeToRemove" key.
<Component Id="cmpSYYKP6B1M7WSD5KLEQ7PZW4YLOPYG61L" Directory="INSTALLDIR" Guid="*">
<File Id="filKUS7ZRMJ0AOKDU6ATYY6IRUSR2ECPDFO" KeyPath="yes" Source="!(wix.StagingAreaPath)\ProofOfPEqualsNP.exe" />
</Component>
Because WiX's Heat.exe only supports XSLT 1.0 and not XSLT 2.0 we cannot use `ends-with( haystack, needle )` (e.g. `ends-with( wix:File/@Source, '.exe' )`...
...but we can use this longer `substring` expression instead (see https://github.com/wixtoolset/issues/issues/5609 )
-->
<xsl:key
name="FileToRemove"
match="wix:Component[ substring( wix:File/@Source, string-length( wix:File/@Source ) - 6 ) != '.cshtml' ]"
use="@Id"
/>
<!-- Get the last 4 characters of a string using `substring( s, len(s) - 3 )`, it uses -3 and not -4 because XSLT uses 1-based indexes, not 0-based indexes. -->
<!-- By default, copy all elements and nodes into the output... -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<!-- ...but if the element has the "ExeToRemove" key then don't render anything (i.e. removing it from the output) -->
<xsl:template match="*[ self::wix:Component or self::wix:ComponentRef ][ key( 'FileToRemove', @Id ) ]" />
</xsl:stylesheet>

4
Setup/Files/config.ini Normal file
View File

@@ -0,0 +1,4 @@
[general]
[database]
file = C:\ProgramData\Elwig\database.sqlite3

23
Setup/Folders.wxs Normal file
View File

@@ -0,0 +1,23 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<!-- C:\Program Files (x86)\Elwig oder C:\Program Files\Elwig -->
<StandardDirectory Id="ProgramFiles64Folder">
<Directory Id="InstallFolder" Name="!(bind.Property.ProductName)" />
</StandardDirectory>
<!-- C:\ProgramData\Elwig -->
<StandardDirectory Id="CommonAppDataFolder">
<Directory Id="ConfigFolder" Name="!(bind.Property.ProductName)">
<Directory Id="ConfigFolderResources" Name="resources" />
</Directory>
</StandardDirectory>
<!-- C:\ProgramData\Microsoft\Windows\Start Menu\Programs -->
<StandardDirectory Id="ProgramMenuFolder">
<Directory Id="StartMenuProgramsFolder" Name="!(bind.Property.ProductName)" />
</StandardDirectory>
<!-- C:\Users{USERNAME}\Desktop -->
<StandardDirectory Id="DesktopFolder" />
</Fragment>
</Wix>

12
Setup/MainComponents.wxs Normal file
View File

@@ -0,0 +1,12 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<ComponentGroup Id="MainComponents">
<Component Directory="InstallFolder">
<File Source="$(var.Elwig.ProjectDir)\bin\Publish\Elwig.exe" Id="Elwig.exe" />
</Component>
<Component Directory="ConfigFolder" Permanent="true" NeverOverwrite="true">
<File Source="$(ProjectDir)\Files\config.ini" Id="config.ini" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

8
Setup/Package.de-at.wxl Normal file
View File

@@ -0,0 +1,8 @@
<!--
This file contains the declaration of all the localizable strings.
-->
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="de-AT">
<String Id="DowngradeError" Value="Eine neuere Version von [ProductName] ist bereits installiert." />
</WixLocalization>

18
Setup/Package.wxs Normal file
View File

@@ -0,0 +1,18 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Name="Elwig" Manufacturer="Elwig" Version="0.1.0" Language="3079" UpgradeCode="a459416a-756a-4be6-b6f4-40872c8425a7" Compressed="true">
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<MediaTemplate EmbedCab="true"/>
<Icon Id="icon.ico" SourceFile="$(var.Elwig.ProjectDir)\elwig.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Feature Id="Main">
<ComponentGroupRef Id="ShortcutComponents" />
<ComponentGroupRef Id="MainComponents" />
<ComponentGroupRef Id="BuildFiles" />
<ComponentGroupRef Id="DocumentTemplates" />
<ComponentGroupRef Id="DocumentTemplateComponents" />
</Feature>
</Package>
</Wix>

45
Setup/Setup.wixproj Normal file
View File

@@ -0,0 +1,45 @@
<Project Sdk="WixToolset.Sdk/4.0.1">
<PropertyGroup>
<HarvestFileSuppressUniqueIds>false</HarvestFileSuppressUniqueIds>
<HarvestFileGenerateGuidsNow>true</HarvestFileGenerateGuidsNow>
<HarvestDirectorySuppressRegistry>false</HarvestDirectorySuppressRegistry>
<HarvestDirectoryVerboseOutput>true</HarvestDirectoryVerboseOutput>
<HarvestProjectsDirectoryIds>InstallFolder</HarvestProjectsDirectoryIds>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>BuildPath=../Elwig/bin/Publish;DocumentTemplatesPath=../Elwig/Documents</DefineConstants>
<PreBuildEvent>curl -s -L "https://unpkg.com/pagedjs/dist/paged.polyfill.js" -o "$(TargetDir)paged.polyfill.js" &amp;&amp; dotnet publish "$(SolutionDir)Elwig\Elwig.csproj" "/p:PublishProfile=$(SolutionDir)\Elwig\Properties\PublishProfiles\FolderProfile.pubxml"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Cultures>de-AT</Cultures>
</PropertyGroup>
<ItemGroup>
<HarvestDirectory Include="../Elwig/bin/Publish">
<ComponentGroupName>BuildFiles</ComponentGroupName>
<DirectoryRefId>InstallFolder</DirectoryRefId>
<SuppressRootDirectory>true</SuppressRootDirectory>
<PreprocessorVariable>BuildPath</PreprocessorVariable>
<Transforms>BuildFilesTransform.xslt</Transforms>
</HarvestDirectory>
<BindPath BindName="BuildBindPath" Include="../Elwig/bin/Publish" />
</ItemGroup>
<ItemGroup>
<HarvestDirectory Include="../Elwig/Documents">
<ComponentGroupName>DocumentTemplates</ComponentGroupName>
<DirectoryRefId>ConfigFolderResources</DirectoryRefId>
<SuppressRootDirectory>true</SuppressRootDirectory>
<PreprocessorVariable>DocumentTemplatesPath</PreprocessorVariable>
<Transforms>DocumentTemplatesTransform.xslt</Transforms>
</HarvestDirectory>
<BindPath BindName="DocumentTemplateBindPath" Include="../Elwig/Documents" />
</ItemGroup>
<ItemGroup>
<None Include="DocumentTemplatesTransform.xslt" />
<None Include="BuildFilesTransform.xslt" />
<None Include="Files\config.ini" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Elwig\Elwig.csproj" PublishProfile="C:\Users\tom\source\repos\elwig-cs\Elwig\Properties\PublishProfiles\FolderProfile.pubxml" Publish="true" />
<PackageReference Include="WixToolset.Heat" Version="4.0.1" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<ComponentGroup Id="ShortcutComponents">
<Component Id="StartMenuFolderShortcut" Directory="StartMenuProgramsFolder" Guid="d21fc601-55f3-44bf-9b36-d0971dd9452d">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="!(bind.Property.ProductName)"
Description="!(bind.Property.ProductName)"
Icon="icon.ico"
Target="[#Elwig.exe]"
WorkingDirectory="InstallFolder"/>
<RemoveFolder Id="StartMenuProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\!(bind.Property.Manufacturer)\!(bind.Property.ProductName)" Name="start_menu_installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
<Component Id="DesktopFolderShortcut" Directory="DesktopFolder" Guid="b7a88e37-a62f-4c60-9464-bd0b384f9803">
<Shortcut Id="DesktopShortcut"
Name="!(bind.Property.ProductName)"
Description="!(bind.Property.ProductName)"
Icon="icon.ico"
Target="[#Elwig.exe]"
WorkingDirectory="InstallFolder"/>
<RegistryValue Root="HKCU" Key="Software\!(bind.Property.Manufacturer)\!(bind.Property.ProductName)" Name="desktop_installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>