<local:ContextWindow
        x:Class="Elwig.Windows.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Elwig.Windows"
        xmlns:ctrl="clr-namespace:Elwig.Controls"
        Title="Elwig" Height="390" Width="520" ResizeMode="CanMinimize"
        Loaded="Window_Loaded" Closing="Window_Closing">
    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Padding" Value="9,3"/>
            <Setter Property="Height" Value="35"/>
            <Setter Property="Width" Value="200"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Menu BorderThickness="0,0,0,1" VerticalAlignment="Top" Height="19" BorderBrush="LightGray" Background="White">
            <MenuItem Header="Datenbank">
                <MenuItem Header="Daten exportieren..." Click="Menu_Database_Export_Click" IsEnabled="False">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xEDE1;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Daten importieren..." Click="Menu_Database_Import_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE8B5;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Datenbank sichern..." Click="Menu_Database_Backup_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xEA35;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Datenbank wiederherstellen..." Click="Menu_Database_Restore_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE777;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Abfragen stellen" Click="Menu_Database_Query_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE756;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Speicherort öffnen..." Click="Menu_Database_Open_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xED25;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem x:Name="Menu_Database_Upload" Header="Datenbank hochladen..." Click="Menu_Database_Upload_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE898;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_Database_Download" Header="Datenbank herunterladen..." Click="Menu_Database_Download_Click" IsEnabled="False">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE896;"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="Synchronisieren" x:Name="Menu_Sync" IsEnabled="false">
                <MenuItem x:Name="Menu_Sync_Download" Header="Mitgliederdaten und Lieferungen herunterladen" Click="Menu_Sync_Download_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE896;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_Sync_UploadBranchDeliveries" Header="Lieferungen dieser Saison/Zweigstelle hochladen" Click="Menu_Sync_UploadBranchDeliveries_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE898;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_Sync_UploadModified" Header="Geänderte Mitglieder und Lieferungen hochladen" Click="Menu_Sync_UploadModified_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xECC5;"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="Waage">
                <MenuItem Header="Datum und Uhrzeit setzen" Click="Menu_Scale_SetDateTime_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xEC92;"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem x:Name="HelpMenu" Header="Hilfe">
                <MenuItem Header="Über" Click="Menu_Help_About_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE946;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_Help_Update" Header="Nach Updates suchen" Click="Menu_Help_Update_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE895;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_Help_Smtp" Header="E-Mail-Einstellungen testen" Click="Menu_Help_Smtp_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE715;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_Help_Log" Header="Fehler-Protokoll anzeigen" Click="Menu_Help_Log_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xF168;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem x:Name="Menu_Help_Config" Header="Konfigurationsdatei öffnen..." Click="Menu_Help_Config_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xEC7A;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_Help_Directory" Header="Konfigurationsspeicherort öffnen..." Click="Menu_Help_Directory_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xED25;"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>

        <Grid Height="100" VerticalAlignment="Top" Margin="0,45,0,0" Width="260">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Image Source="\Resources\Images\Elwig.png" RenderOptions.BitmapScalingMode="HighQuality" Grid.Column="0"
                   HorizontalAlignment="Left" Margin="5,5,5,5" VerticalAlignment="Top"/>
            <TextBlock Grid.Column="1" FontSize="32" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top">
                Elwig
            </TextBlock>
            <TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="0,50,0,0" VerticalAlignment="Top" LineHeight="14" LineStackingStrategy="BlockLineHeight">
                Elektonische Winzer-<LineBreak/>
                genossenschaftsverwaltung
            </TextBlock>
            <TextBlock x:Name="VersionField" Grid.Column="1" FontSize="10" HorizontalAlignment="Left" Margin="0,80,0,0" VerticalAlignment="Top">
                Version: ?
            </TextBlock>
        </Grid>

        <Button x:Name="MemberAdminButton" Click="MemberAdminButton_Click"
                Margin="0,170,205,0">
            <Grid>
                <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE77B;"
                           TextAlignment="Left" HorizontalAlignment="Left" Padding="0.5,1.5,0,0"/>
                <TextBlock TextAlignment="Center">Mitglieder</TextBlock>
            </Grid>
        </Button>
        <Button x:Name="MailButton" Click="MailButton_Click"
                Margin="205,170,0,0">
            <Grid>
                <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE715;"
                           TextAlignment="Left" HorizontalAlignment="Left" Padding="0.5,1.5,0,0"/>
                <TextBlock TextAlignment="Center">Rundschreiben</TextBlock>
            </Grid>
        </Button>
        <Button x:Name="DeliveryAdminButton" Click="DeliveryAdminButton_Click"
                Margin="0,210,205,0">
            <Grid>
                <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE736;"
                           TextAlignment="Left" HorizontalAlignment="Left" Padding="0.5,1.5,0,0"/>
                <TextBlock TextAlignment="Center">Lieferungen</TextBlock>
            </Grid>
        </Button>
        <Button x:Name="ReceiptButton" Click="ReceiptButton_Click"
                Margin="205,210,0,0">
            <Grid>
                <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xEC5B;"
                           TextAlignment="Left" HorizontalAlignment="Left" Padding="0.5,1.5,0,0"/>
                <TextBlock TextAlignment="Center">Übernahme</TextBlock>
            </Grid>
        </Button>
        <Button x:Name="BaseDataButton" Click="BaseDataButton_Click"
                Margin="0,250,205,0">
            <Grid>
                <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE713;"
                           TextAlignment="Left" HorizontalAlignment="Left" Padding="0.5,1.5,0,0"/>
                <TextBlock TextAlignment="Center">Stammdaten</TextBlock>
            </Grid>
        </Button>
        <Button x:Name="DeliveryAncmtButton" Click="DeliveryAncmtButton_Click"
                Margin="205,250,0,0">
            <Grid>
                <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xF0E4;"
                           TextAlignment="Left" HorizontalAlignment="Left" Padding="0.5,1.5,0,0"/>
                <TextBlock TextAlignment="Center">Anmeldungen</TextBlock>
            </Grid>
        </Button>

        <Button x:Name="SyncButton" Click="SyncButton_Click"
                Margin="375,135,0,0" Padding="1.0,0.5,0,0" Height="30" Width="30"
                FontFamily="Segoe MDL2 Assets" FontSize="16"
                HorizontalContentAlignment="Center"
                ToolTip="Geänderte Mitgliederdaten und Lieferungen synchronisieren">
            <Button.Content>
                <Grid TextElement.FontFamily="Segoe MDL2 Assets">
                    <TextBlock x:Name="SyncButton_1" Text="&#xE895;"/>
                    <TextBlock x:Name="SyncButton_2" Text="" Foreground="DarkOrange"/>
                </Grid>
            </Button.Content>
        </Button>

        <Expander x:Name="SeasonFinish" Header="Leseabschluss" SnapsToDevicePixels="True"
                  Expanded="SeasonFinish_Expanded" Collapsed="SeasonFinish_Collapsed"
                  HorizontalAlignment="Center" Width="407" Margin="0,290,0,0" VerticalAlignment="Top">
            <Grid>
                <Border BorderBrush="LightGray" BorderThickness="1"/>
                <Label Content="Saison:" Margin="0,13,100,0" VerticalAlignment="Top" HorizontalAlignment="Center" Padding="2,4,2,4" Height="25"/>
                <ctrl:IntegerUpDown x:Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1900" Maximum="9999"
                                    Margin="0,13,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
                                    TextChanged="SeasonInput_TextChanged"/>

                <Button x:Name="DeliveryConfirmationButton"
                        Click="DeliveryConfirmationButton_Click"
                        Margin="0,50,195,10" Width="190">
                    <Grid>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE715;"
                                   TextAlignment="Left" HorizontalAlignment="Left" Padding="0.5,0.5,0,0"/>
                        <TextBlock FontSize="12" Margin="18,1,0,0" TextAlignment="Center">Anlieferungsbestätigung</TextBlock>
                    </Grid>
                </Button>

                <Button x:Name="PaymentButton"
                        Click="PaymentButton_Click"
                        Margin="195,50,0,10" Width="190">
                    <Grid>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE8EF;"
                                  TextAlignment="Left" HorizontalAlignment="Left" Padding="0.5,1.5,0,0"/>
                        <TextBlock TextAlignment="Center">Auszahlung</TextBlock>
                    </Grid>
                </Button>

                <Button x:Name="OverUnderDeliveryButton"
                        Click="OverUnderDeliveryButton_Click"
                        Margin="0,90,195,10" Width="190" Padding="3,5,5,5"
                        ToolTip="Über-/Unterlieferungen laut gezeichneten Geschäftsanteilen und Unterlieferungen nach Flächenbindungen">
                    <Grid>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE9F9;"
                                   TextAlignment="Left" HorizontalAlignment="Left" Padding="6.5,0.5,0,0"/>
                        <TextBlock FontSize="12" Margin="18,1,0,0" TextAlignment="Center">Über-/Unterlieferungen</TextBlock>
                    </Grid>
                </Button>

                <Button x:Name="BreakdownButton"
                        Click="BreakdownButton_Click"
                        Margin="195,90,0,10" Width="190" Padding="3,5,5,5"
                        ToolTip="Aufschlüsselung der Menge nach Zweigstelle, Sorte, Attribut/Bewirt., Qualitätsstufe, gebunden/ungebunden">
                    <Grid>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE9F9;"
                                   TextAlignment="Left" HorizontalAlignment="Left" Padding="6.5,0.5,0,0"/>
                        <TextBlock FontSize="12" Margin="18,1,0,0" TextAlignment="Center">Sorten-/Qual.aufschlüssel.</TextBlock>
                    </Grid>
                </Button>

                <Button x:Name="AreaCommitmentsButton"
                        Click="AreaCommitmentsButton_Click"
                        Margin="0,130,195,10" Width="190" Padding="3,5,5,5"
                        ToolTip="Aktive Flächenbindungen der Saison pro Mitglied und Sorte/Attribut">
                    <Grid>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE9F9;"
                                   TextAlignment="Left" HorizontalAlignment="Left" Padding="6.5,1.5,0,0"/>
                        <TextBlock Margin="18,0,0,0" TextAlignment="Center">Flächenbindungen</TextBlock>
                    </Grid>
                </Button>

                <Button x:Name="BreakdownMemberVarietyButton"
                        Click="BreakdownMemberVarietyButton_Click"
                        Margin="195,130,0,10" Width="190" Padding="3,5,5,5"
                        ToolTip="Liefermengen und Ertrag (kg/ha) pro Mitglied">
                    <Grid>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE9F9;"
                                   TextAlignment="Left" HorizontalAlignment="Left" Padding="6.5,1.5,0,0"/>
                        <TextBlock Margin="18,0,0,0" TextAlignment="Center">Liefermengen/Ertrag</TextBlock>
                    </Grid>
                </Button>

                <Grid VerticalAlignment="Bottom" Margin="50,175,50,15">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="60"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="1" TextAlignment="Right"><Bold>Mitglieder</Bold></TextBlock>
                    <TextBlock Grid.Row="0" Grid.Column="2" TextAlignment="Right"><Bold>Menge</Bold></TextBlock>
                    <TextBlock Grid.Row="0" Grid.Column="3" TextAlignment="Right"><Bold>Fläche</Bold></TextBlock>

                    <TextBlock Grid.Row="1" Grid.Column="0">Gesamt:</TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="0">Gebunden:</TextBlock>
                    <TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">Ungebunden:</TextBlock>

                    <TextBlock Grid.Row="1" Grid.Column="1" TextAlignment="Right" x:Name="SeasonStatMembersTotal">-</TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="1" TextAlignment="Right" x:Name="SeasonStatMembersGeb">-</TextBlock>
                    <TextBlock Grid.Row="3" Grid.Column="1" TextAlignment="Right">-</TextBlock>

                    <TextBlock Grid.Row="1" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightTotal">-</TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightGeb">-</TextBlock>
                    <TextBlock Grid.Row="3" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightUngeb">-</TextBlock>

                    <TextBlock Grid.Row="1" Grid.Column="3" TextAlignment="Right">-</TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="3" TextAlignment="Right" x:Name="SeasonStatArea">-</TextBlock>
                    <TextBlock Grid.Row="3" Grid.Column="3" TextAlignment="Right">-</TextBlock>
                </Grid>
            </Grid>
        </Expander>
    </Grid>
</local:ContextWindow>
