This commit is contained in:
		@@ -26,6 +26,7 @@ namespace Elwig {
 | 
			
		||||
        private readonly DispatcherTimer _autoUpdateTimer = new() { Interval = TimeSpan.FromHours(1) };
 | 
			
		||||
 | 
			
		||||
        public static readonly string DataPath = @"C:\ProgramData\Elwig\";
 | 
			
		||||
        public static readonly string MailsPath = Path.Combine(DataPath, "mails");
 | 
			
		||||
        public static readonly string ConfigPath = Path.Combine(DataPath, "config.ini");
 | 
			
		||||
        public static readonly string ExePath = @"C:\Program Files\Elwig\";
 | 
			
		||||
        public static readonly string TempPath = Path.Combine(Path.GetTempPath(), "Elwig");
 | 
			
		||||
@@ -56,6 +57,7 @@ namespace Elwig {
 | 
			
		||||
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
            Directory.CreateDirectory(TempPath);
 | 
			
		||||
            Directory.CreateDirectory(DataPath);
 | 
			
		||||
            Directory.CreateDirectory(MailsPath);
 | 
			
		||||
            MainDispatcher = Dispatcher;
 | 
			
		||||
            Scales = [];
 | 
			
		||||
            CurrentApp = this;
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ using System.Linq;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Controls.Primitives;
 | 
			
		||||
using System.Windows.Threading;
 | 
			
		||||
using Brush = System.Windows.Media.Brush;
 | 
			
		||||
using Brushes = System.Windows.Media.Brushes;
 | 
			
		||||
 | 
			
		||||
@@ -234,5 +235,21 @@ namespace Elwig.Helpers {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void InitializeDelayTimer(TextBox tb, Action<object, TextChangedEventArgs> handler) {
 | 
			
		||||
            var timer = new DispatcherTimer {
 | 
			
		||||
                Interval = TimeSpan.FromMilliseconds(250)
 | 
			
		||||
            };
 | 
			
		||||
            timer.Tick += (object? sender, EventArgs evt) => {
 | 
			
		||||
                timer.Stop();
 | 
			
		||||
                var (oSender, oEvent) = ((object, TextChangedEventArgs))timer.Tag;
 | 
			
		||||
                handler(oSender, oEvent);
 | 
			
		||||
            };
 | 
			
		||||
            tb.TextChanged += (object sender, TextChangedEventArgs evt) => {
 | 
			
		||||
                timer.Stop();
 | 
			
		||||
                timer.Tag = (sender, evt);
 | 
			
		||||
                timer.Start();
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -594,5 +594,76 @@ namespace Elwig.Helpers {
 | 
			
		||||
        public static IEnumerable<AreaCom> ActiveAreaCommitments(IEnumerable<AreaCom> query) => ActiveAreaCommitments(query, CurrentYear);
 | 
			
		||||
        public static IEnumerable<AreaCom> ActiveAreaCommitments(IEnumerable<AreaCom> query, int year) =>
 | 
			
		||||
            query.Where(c => ActiveAreaCommitments(year).Invoke(c));
 | 
			
		||||
 | 
			
		||||
        public static async Task<(DateTime DateTime, string Type, int MgNr, string Name, string[] Addresses, string Subject, string[] Attachments)[]> GetSentMails(DateOnly? fromDate = null, DateOnly? toDate = null) {
 | 
			
		||||
            var f = $"{fromDate:yyyy-MM-dd}";
 | 
			
		||||
            var t = $"{toDate:yyyy-MM-dd}";
 | 
			
		||||
            try {
 | 
			
		||||
                var rows = new List<(DateTime, string, int, string, string[], string, string[])>();
 | 
			
		||||
                var filenames = Directory.GetFiles(App.MailsPath, "????.csv")
 | 
			
		||||
                    .Where(n => fromDate == null || Path.GetFileName(n).CompareTo($"{fromDate.Value.Year}.csv") >= 0)
 | 
			
		||||
                    .Where(n => toDate   == null || Path.GetFileName(n).CompareTo($"{toDate.Value.Year}.csv")   <= 0)
 | 
			
		||||
                    .Order();
 | 
			
		||||
                foreach (var filename in filenames) {
 | 
			
		||||
                    using var reader = new StreamReader(filename, Utils.UTF8);
 | 
			
		||||
                    string? line;
 | 
			
		||||
                    while ((line = await reader.ReadLineAsync()) != null) {
 | 
			
		||||
                        try {
 | 
			
		||||
                            if (line.Length < 20 || line[10] != ';' || line[19] != ';')
 | 
			
		||||
                                continue;
 | 
			
		||||
                            var date = line[..10];
 | 
			
		||||
                            if (fromDate != null && date.CompareTo(f) < 0) {
 | 
			
		||||
                                continue;
 | 
			
		||||
                            } else if (toDate != null && date.CompareTo(t) > 0) {
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            var p = line.Split(';');
 | 
			
		||||
                            rows.Add((
 | 
			
		||||
                                DateOnly.ParseExact(p[0], "yyyy-MM-dd").ToDateTime(TimeOnly.ParseExact(p[1], "HH:mm:ss")),
 | 
			
		||||
                                p[2],
 | 
			
		||||
                                int.Parse(p[3]),
 | 
			
		||||
                                p[4],
 | 
			
		||||
                                p[5].Split(',').Select(a => a.Replace(" | ", "\n")).ToArray(),
 | 
			
		||||
                                p[6],
 | 
			
		||||
                                p[7].Split(',')
 | 
			
		||||
                            ));
 | 
			
		||||
                        } catch {
 | 
			
		||||
                            continue;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return [.. rows];
 | 
			
		||||
            } catch {
 | 
			
		||||
                return [];
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static async Task AddSentMails(IEnumerable<(string Type, int MgNr, string Name, string[] Addresses, string Subject, string[] Attachments)> data) {
 | 
			
		||||
            var now = DateTime.Now;
 | 
			
		||||
            var filename = Path.Combine(App.MailsPath, $"{now.Year}.csv");
 | 
			
		||||
            await File.AppendAllLinesAsync(filename, data.Select(d =>
 | 
			
		||||
                $"{now:yyyy-MM-dd;HH:mm:ss};{d.Type};" +
 | 
			
		||||
                $"{d.MgNr};{d.Name.Replace(';', ' ')};" +
 | 
			
		||||
                $"{string.Join(',', d.Addresses.Select(a => a.Replace(';', ' ').Replace(',', ' ').Replace("\n", " | ")))};" +
 | 
			
		||||
                $"{d.Subject.Replace(';', ' ')};" +
 | 
			
		||||
                $"{string.Join(',', d.Attachments.Select(a => a.Replace(';', ' ').Replace(',', ' ')))}"
 | 
			
		||||
            ), Utils.UTF8);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static async Task<string?> FindSentMailBody(DateTime target) {
 | 
			
		||||
            var dt = $"{target:yyyy-MM-dd_HH-mm-ss}_";
 | 
			
		||||
            var filename = Directory.GetFiles(App.MailsPath, "????-??-??_??-??-??_*.txt")
 | 
			
		||||
                .Where(n => Path.GetFileName(n).CompareTo(dt) <= 0)
 | 
			
		||||
                .Order()
 | 
			
		||||
                .LastOrDefault();
 | 
			
		||||
            if (filename == null)
 | 
			
		||||
                return null;
 | 
			
		||||
            return await File.ReadAllTextAsync(filename, Utils.UTF8);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static async Task AddSentMailBody(string subject, string body, int recipients) {
 | 
			
		||||
            var filename = Path.Combine(App.MailsPath, $"{DateTime.Now:yyyy-MM-dd_HH-mm-ss}_{NormalizeFileName(subject)}.txt");
 | 
			
		||||
            await File.WriteAllTextAsync(filename, $"# {subject}\r\n# Vorgesehene Empfänger: {recipients}\r\n\r\n" + body, Utils.UTF8);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,6 @@ using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Threading;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
 | 
			
		||||
namespace Elwig.Windows {
 | 
			
		||||
@@ -358,22 +357,6 @@ namespace Elwig.Windows {
 | 
			
		||||
            UpdateComboBox(ortInput);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected static void InitializeDelayTimer(TextBox tb, Action<object, TextChangedEventArgs> handler) {
 | 
			
		||||
            var timer = new DispatcherTimer {
 | 
			
		||||
                Interval = TimeSpan.FromMilliseconds(250)
 | 
			
		||||
            };
 | 
			
		||||
            timer.Tick += (object? sender, EventArgs evt) => {
 | 
			
		||||
                timer.Stop();
 | 
			
		||||
                var (oSender, oEvent) = ((object, TextChangedEventArgs))timer.Tag;
 | 
			
		||||
                handler(oSender, oEvent);
 | 
			
		||||
            };
 | 
			
		||||
            tb.TextChanged += (object sender, TextChangedEventArgs evt) => {
 | 
			
		||||
                timer.Stop();
 | 
			
		||||
                timer.Tag = (sender, evt);
 | 
			
		||||
                timer.Start();
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected bool InputTextChanged(TextBox input) {
 | 
			
		||||
            return InputTextChanged(input, new ValidationResult(true, null));
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ namespace Elwig.Windows {
 | 
			
		||||
                GstNrInput, AreaInput, AreaComTypeInput, WineCultivationInput
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
            InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            ControlUtils.InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            SearchInput.TextChanged -= SearchInput_TextChanged;
 | 
			
		||||
            ActiveAreaCommitmentInput.Content = ((string)ActiveAreaCommitmentInput.Content).Replace("2020", $"{Utils.CurrentLastSeason}");
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ namespace Elwig.Windows {
 | 
			
		||||
            SecondsTimer.Tick += new EventHandler(OnSecondPassed);
 | 
			
		||||
            SecondsTimer.Interval = new TimeSpan(0, 0, 1);
 | 
			
		||||
 | 
			
		||||
            InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            ControlUtils.InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            SearchInput.TextChanged -= SearchInput_TextChanged;
 | 
			
		||||
            ViewModel.FilterSeason = Utils.CurrentLastSeason;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ namespace Elwig.Windows {
 | 
			
		||||
 | 
			
		||||
            DoShowWarningWindows = false;
 | 
			
		||||
 | 
			
		||||
            InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            ControlUtils.InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            SearchInput.TextChanged -= SearchInput_TextChanged;
 | 
			
		||||
            ViewModel.FilterSeason = Utils.CurrentLastSeason;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ namespace Elwig.Windows {
 | 
			
		||||
                DateInput, BranchInput, DescriptionInput, MainWineVarietiesInput,
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
            InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            ControlUtils.InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            SearchInput.TextChanged -= SearchInput_TextChanged;
 | 
			
		||||
            ViewModel.FilterSeason = Utils.CurrentLastSeason;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -36,9 +36,10 @@ namespace Elwig.Windows {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void EventList_SelectionChanged(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            var t = EventList.SelectedItem.GetType();
 | 
			
		||||
            var item = EventList.SelectedItem;
 | 
			
		||||
            var t = item.GetType();
 | 
			
		||||
            var p = t.GetProperty("Event")!;
 | 
			
		||||
            EventData.Text = ((EventLogEntry)p.GetValue(EventList.SelectedItem)!).Message;
 | 
			
		||||
            EventData.Text = ((EventLogEntry)p.GetValue(item)!).Message;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										54
									
								
								Elwig/Windows/MailLogWindow.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								Elwig/Windows/MailLogWindow.xaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
<Window x:Class="Elwig.Windows.MailLogWindow"
 | 
			
		||||
        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:local="clr-namespace:Elwig.Windows"
 | 
			
		||||
        Title="Ausgangs-Protokoll - Rundschreiben - Elwig" Height="600" Width="1000">
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.ColumnDefinitions>
 | 
			
		||||
            <ColumnDefinition Width="3*"/>
 | 
			
		||||
            <ColumnDefinition Width="5"/>
 | 
			
		||||
            <ColumnDefinition Width="2*"/>
 | 
			
		||||
        </Grid.ColumnDefinitions>
 | 
			
		||||
 | 
			
		||||
        <TextBox x:Name="FilterInput" Margin="10,10,300,10" Height="25" FontSize="14" Padding="2" TextWrapping="NoWrap"
 | 
			
		||||
                 HorizontalAlignment="Stretch" VerticalAlignment="Top"
 | 
			
		||||
                 TextChanged="FilterInput_TextChanged"/>
 | 
			
		||||
 | 
			
		||||
        <ComboBox x:Name="TypeInput" Margin="10,10,165,10" Width="130" Height="25" FontSize="14"
 | 
			
		||||
                  HorizontalAlignment="Right" VerticalAlignment="Top"
 | 
			
		||||
                  SelectionChanged="TypeInput_SelectionChanged">
 | 
			
		||||
            <ComboBoxItem Content="Post & E-Mail" IsSelected="True"/>
 | 
			
		||||
            <ComboBoxItem Content="Nur Post"/>
 | 
			
		||||
            <ComboBoxItem Content="Nur E-Mail"/>
 | 
			
		||||
        </ComboBox>
 | 
			
		||||
 | 
			
		||||
        <ComboBox x:Name="TimeSpanInput" Margin="10,10,10,10" Width="150" Height="25" FontSize="14"
 | 
			
		||||
                  HorizontalAlignment="Right" VerticalAlignment="Top"
 | 
			
		||||
                  SelectionChanged="TimeSpanInput_SelectionChanged">
 | 
			
		||||
            <ComboBoxItem Content="letzten 7 Tage" IsSelected="True"/>
 | 
			
		||||
            <ComboBoxItem Content="letzten 6 Monate"/>
 | 
			
		||||
            <ComboBoxItem Content="Immer"/>
 | 
			
		||||
        </ComboBox>
 | 
			
		||||
 | 
			
		||||
        <DataGrid x:Name="MailList" AutoGenerateColumns="False" HeadersVisibility="Column" IsReadOnly="True" GridLinesVisibility="None" SelectionMode="Single"
 | 
			
		||||
                  CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False"
 | 
			
		||||
                  SelectionChanged="MailList_SelectionChanged"
 | 
			
		||||
                  Margin="10,40,5,10">
 | 
			
		||||
            <DataGrid.Columns>
 | 
			
		||||
                <DataGridTextColumn Header="Zeitpunkt" Binding="{Binding DateTime, StringFormat='{}{0:dd.MM.yyyy HH:mm:ss}'}" Width="120"/>
 | 
			
		||||
                <DataGridTextColumn Header="Typ" Binding="{Binding Type}" Width="50"/>
 | 
			
		||||
                <DataGridTextColumn Header="MgNr." Binding="{Binding MgNr}" Width="50"/>
 | 
			
		||||
                <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="200"/>
 | 
			
		||||
                <DataGridTextColumn Header="Adressen" Binding="{Binding Addresses}" Width="200"/>
 | 
			
		||||
                <DataGridTextColumn Header="Betreff" Binding="{Binding Subject}" Width="250"/>
 | 
			
		||||
                <DataGridTextColumn Header="Anhänge" Binding="{Binding Attachments}" Width="200"/>
 | 
			
		||||
            </DataGrid.Columns>
 | 
			
		||||
        </DataGrid>
 | 
			
		||||
 | 
			
		||||
        <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
 | 
			
		||||
 | 
			
		||||
        <TextBox x:Name="MailData" Grid.Column="2" Margin="5,10,10,10" IsReadOnly="True"
 | 
			
		||||
                 HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"/>
 | 
			
		||||
    </Grid>
 | 
			
		||||
</Window>
 | 
			
		||||
							
								
								
									
										83
									
								
								Elwig/Windows/MailLogWindow.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								Elwig/Windows/MailLogWindow.xaml.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,83 @@
 | 
			
		||||
using Elwig.Helpers;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
 | 
			
		||||
namespace Elwig.Windows {
 | 
			
		||||
    public partial class MailLogWindow : Window {
 | 
			
		||||
 | 
			
		||||
        record struct Row (DateTime DateTime, string Type, int MgNr, string Name, string Addresses, string Subject, string Attachments);
 | 
			
		||||
 | 
			
		||||
        private List<Row> Data = [];
 | 
			
		||||
 | 
			
		||||
        public MailLogWindow() {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
            WindowState = WindowState.Maximized;
 | 
			
		||||
            ControlUtils.InitializeDelayTimer(FilterInput, FilterInput_TextChanged);
 | 
			
		||||
            FilterInput.TextChanged -= FilterInput_TextChanged;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private async void TimeSpanInput_SelectionChanged(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            DateTime? fromDate = DateTime.Now;
 | 
			
		||||
            if (TimeSpanInput.SelectedIndex == 0) {
 | 
			
		||||
                fromDate = fromDate.Value.AddDays(-7);
 | 
			
		||||
            } else if (TimeSpanInput.SelectedIndex == 1) {
 | 
			
		||||
                fromDate = fromDate.Value.AddMonths(-6);
 | 
			
		||||
            } else {
 | 
			
		||||
                fromDate = null;
 | 
			
		||||
            }
 | 
			
		||||
            var mails = await Utils.GetSentMails(fromDate: fromDate == null ? null : DateOnly.FromDateTime(fromDate.Value));
 | 
			
		||||
            Data = mails.Reverse().Select(m => new Row(
 | 
			
		||||
                m.DateTime,
 | 
			
		||||
                m.Type == "email" ? "E-Mail" : m.Type == "postal" ? "Post" : "?",
 | 
			
		||||
                m.MgNr,
 | 
			
		||||
                m.Name,
 | 
			
		||||
                string.Join("\n", m.Addresses),
 | 
			
		||||
                m.Subject,
 | 
			
		||||
                string.Join("\n", m.Attachments)
 | 
			
		||||
            )).ToList();
 | 
			
		||||
            MailList.ItemsSource = Data;
 | 
			
		||||
            ApplyFilters();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void FilterInput_TextChanged(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            ApplyFilters();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void TypeInput_SelectionChanged(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            ApplyFilters();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ApplyFilters() {
 | 
			
		||||
            var filters = FilterInput.Text.Split(' ');
 | 
			
		||||
            IEnumerable<Row> data = Data;
 | 
			
		||||
            switch (TypeInput.SelectedIndex) {
 | 
			
		||||
                case 1: data = data.Where(d => d.Type == "Post"); break;
 | 
			
		||||
                case 2: data = data.Where(d => d.Type == "E-Mail"); break;
 | 
			
		||||
            }
 | 
			
		||||
            foreach (var filter in filters) {
 | 
			
		||||
                if (int.TryParse(filter, out var mgnr)) {
 | 
			
		||||
                    data = data.Where(d => d.MgNr == mgnr);
 | 
			
		||||
                } else {
 | 
			
		||||
                    var f = filter.ToLower();
 | 
			
		||||
                    data = data.Where(d => d.Name.Contains(f, StringComparison.CurrentCultureIgnoreCase) ||
 | 
			
		||||
                                           d.Addresses.Contains(f, StringComparison.CurrentCultureIgnoreCase) ||
 | 
			
		||||
                                           d.Subject.Contains(f, StringComparison.CurrentCultureIgnoreCase) ||
 | 
			
		||||
                                           d.Attachments.Contains(f, StringComparison.CurrentCultureIgnoreCase));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (IsLoaded)
 | 
			
		||||
                MailList.ItemsSource = data.ToList();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private async void MailList_SelectionChanged(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            if (MailList.SelectedItem is not Row item) return;
 | 
			
		||||
            if (item.Type == "E-Mail") {
 | 
			
		||||
                MailData.Text = await Utils.FindSentMailBody(item.DateTime);
 | 
			
		||||
            } else {
 | 
			
		||||
                MailData.Text = "";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -27,281 +27,334 @@
 | 
			
		||||
            <Setter Property="TextWrapping" Value="NoWrap"/>
 | 
			
		||||
        </Style>
 | 
			
		||||
    </Window.Resources>
 | 
			
		||||
    <TabControl x:Name="TabControl" BorderThickness="0" PreviewDragOver="Document_PreviwDragOver" AllowDrop="True" Drop="Document_Drop">
 | 
			
		||||
        <TabItem Header="Dokumente" Visibility="Collapsed">
 | 
			
		||||
            <Grid>
 | 
			
		||||
                <Grid.ColumnDefinitions>
 | 
			
		||||
                    <ColumnDefinition Width="*"/>
 | 
			
		||||
                    <ColumnDefinition Width="320"/>
 | 
			
		||||
                </Grid.ColumnDefinitions>
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="19"/>
 | 
			
		||||
            <RowDefinition Height="1*"/>
 | 
			
		||||
            <RowDefinition Height="24"/>
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
 | 
			
		||||
                <Grid Height="200" VerticalAlignment="Top" HorizontalAlignment="Stretch">
 | 
			
		||||
        <Menu BorderThickness="0,0,0,1" BorderBrush="LightGray" Background="White">
 | 
			
		||||
            <MenuItem Header="Hilfe">
 | 
			
		||||
                <MenuItem x:Name="Menu_Help_Log" Header="Ausgangs-Protokoll anzeigen"
 | 
			
		||||
                          Click="Menu_Help_Log_Click">
 | 
			
		||||
                    <MenuItem.Icon>
 | 
			
		||||
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""/>
 | 
			
		||||
                    </MenuItem.Icon>
 | 
			
		||||
                </MenuItem>
 | 
			
		||||
            </MenuItem>
 | 
			
		||||
        </Menu>
 | 
			
		||||
 | 
			
		||||
        <TabControl x:Name="TabControl" BorderThickness="0" Grid.Row="1"
 | 
			
		||||
                    PreviewDragOver="Document_PreviwDragOver" AllowDrop="True" Drop="Document_Drop">
 | 
			
		||||
            <TabItem Header="Dokumente" Visibility="Collapsed">
 | 
			
		||||
                <Grid>
 | 
			
		||||
                    <Grid.ColumnDefinitions>
 | 
			
		||||
                        <ColumnDefinition Width="*"/>
 | 
			
		||||
                        <ColumnDefinition Width="25"/>
 | 
			
		||||
                        <ColumnDefinition Width="*"/>
 | 
			
		||||
                        <ColumnDefinition Width="320"/>
 | 
			
		||||
                    </Grid.ColumnDefinitions>
 | 
			
		||||
                    <Grid.RowDefinitions>
 | 
			
		||||
                        <RowDefinition Height="*"/>
 | 
			
		||||
                        <RowDefinition Height="30"/>
 | 
			
		||||
                    </Grid.RowDefinitions>
 | 
			
		||||
 | 
			
		||||
                    <Label Content="Verfügbare Dokumente"
 | 
			
		||||
                           Grid.Column="0" Margin="10,8,10,10"/>
 | 
			
		||||
                    <ListBox x:Name="AvaiableDocumentsList"
 | 
			
		||||
                             Grid.Column="0" Margin="10,30,10,10"
 | 
			
		||||
                             SelectionChanged="AvaiableDocumentsList_SelectionChanged"/>
 | 
			
		||||
 | 
			
		||||
                    <Button x:Name="DocumentAddButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="14"
 | 
			
		||||
                            Grid.Column="1" Margin="0,0,0,30" VerticalAlignment="Center" Height="25" IsEnabled="False"
 | 
			
		||||
                            Click="DocumentAddButton_Click"/>
 | 
			
		||||
                    <Button x:Name="DocumentRemoveButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="16" Padding="1.5,0,0,0"
 | 
			
		||||
                            Grid.Column="1" Margin="0,30,0,0" VerticalAlignment="Center" Height="25" IsEnabled="False"
 | 
			
		||||
                            Click="DocumentRemoveButton_Click"/>
 | 
			
		||||
 | 
			
		||||
                    <Label Content="Ausgewählte Dokumente"
 | 
			
		||||
                           Grid.Column="2" Margin="10,8,10,10"/>
 | 
			
		||||
                    <ListBox x:Name="SelectedDocumentsList" DisplayMemberPath="Name"
 | 
			
		||||
                             Grid.Column="2" Margin="10,30,10,37"
 | 
			
		||||
                             SelectionChanged="SelectedDocumentsList_SelectionChanged">
 | 
			
		||||
                        <ListBox.InputBindings>
 | 
			
		||||
                            <KeyBinding Key="Delete" Command="{Binding Path=DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>
 | 
			
		||||
                        </ListBox.InputBindings>
 | 
			
		||||
                    </ListBox>
 | 
			
		||||
                    <Button x:Name="SelectDocumentButton" Content="Durchsuchen..."
 | 
			
		||||
                            Grid.Column="2" VerticalAlignment="Bottom" Margin="10,10,10,10" Height="22"
 | 
			
		||||
                            Click="SelectDocumentButton_Click"/>
 | 
			
		||||
                </Grid>
 | 
			
		||||
 | 
			
		||||
                <GroupBox x:Name="DocumentBox" Header="Dokument" Margin="10,170,10,47" HorizontalAlignment="Stretch">
 | 
			
		||||
                    <Grid>
 | 
			
		||||
                    <Grid Height="200" VerticalAlignment="Top" HorizontalAlignment="Stretch">
 | 
			
		||||
                        <Grid.ColumnDefinitions>
 | 
			
		||||
                            <ColumnDefinition Width="70"/>
 | 
			
		||||
                            <ColumnDefinition Width="*"/>
 | 
			
		||||
                            <ColumnDefinition Width="25"/>
 | 
			
		||||
                            <ColumnDefinition Width="*"/>
 | 
			
		||||
                        </Grid.ColumnDefinitions>
 | 
			
		||||
                        <Grid.RowDefinitions>
 | 
			
		||||
                            <RowDefinition Height="*"/>
 | 
			
		||||
                            <RowDefinition Height="30"/>
 | 
			
		||||
                        </Grid.RowDefinitions>
 | 
			
		||||
 | 
			
		||||
                        <CheckBox x:Name="DocumentNonDeliverersInput" Content="Auch Nicht-Lieferanten miteinbeziehen"
 | 
			
		||||
                                  Margin="10,10,10,10" Grid.Column="1"/>
 | 
			
		||||
                        <Label Content="Verfügbare Dokumente"
 | 
			
		||||
                               Grid.Column="0" Margin="10,8,10,10"/>
 | 
			
		||||
                        <ListBox x:Name="AvaiableDocumentsList"
 | 
			
		||||
                                 Grid.Column="0" Margin="10,30,10,10"
 | 
			
		||||
                                 SelectionChanged="AvaiableDocumentsList_SelectionChanged"/>
 | 
			
		||||
 | 
			
		||||
                        <Label x:Name="DocumentFooterLabel" Content="Fußtext:" Margin="10,40,0,10"/>
 | 
			
		||||
                        <TextBox x:Name="DeliveryConfirmationFooterInput" Grid.Column="1"
 | 
			
		||||
                                 Margin="0,40,10,10" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
 | 
			
		||||
                                 AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap"
 | 
			
		||||
                                 TextChanged="DocumentInput_TextChanged"/>
 | 
			
		||||
                        <TextBox x:Name="CreditNoteFooterInput" Grid.Column="1"
 | 
			
		||||
                                 Margin="0,10,10,10" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
 | 
			
		||||
                                 AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap"
 | 
			
		||||
                                 TextChanged="DocumentInput_TextChanged"/>
 | 
			
		||||
                        <Button x:Name="DocumentAddButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="14"
 | 
			
		||||
                                Grid.Column="1" Margin="0,0,0,30" VerticalAlignment="Center" Height="25" IsEnabled="False"
 | 
			
		||||
                                Click="DocumentAddButton_Click"/>
 | 
			
		||||
                        <Button x:Name="DocumentRemoveButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="16" Padding="1.5,0,0,0"
 | 
			
		||||
                                Grid.Column="1" Margin="0,30,0,0" VerticalAlignment="Center" Height="25" IsEnabled="False"
 | 
			
		||||
                                Click="DocumentRemoveButton_Click"/>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Ausgewählte Dokumente"
 | 
			
		||||
                               Grid.Column="2" Margin="10,8,10,10"/>
 | 
			
		||||
                        <ListBox x:Name="SelectedDocumentsList" DisplayMemberPath="Name"
 | 
			
		||||
                                 Grid.Column="2" Margin="10,30,10,37"
 | 
			
		||||
                                 SelectionChanged="SelectedDocumentsList_SelectionChanged">
 | 
			
		||||
                            <ListBox.InputBindings>
 | 
			
		||||
                                <KeyBinding Key="Delete" Command="{Binding Path=DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>
 | 
			
		||||
                            </ListBox.InputBindings>
 | 
			
		||||
                        </ListBox>
 | 
			
		||||
                        <Button x:Name="SelectDocumentButton" Content="Durchsuchen..."
 | 
			
		||||
                                Grid.Column="2" VerticalAlignment="Bottom" Margin="10,10,10,10" Height="22"
 | 
			
		||||
                                Click="SelectDocumentButton_Click"/>
 | 
			
		||||
                    </Grid>
 | 
			
		||||
                </GroupBox>
 | 
			
		||||
 | 
			
		||||
                <TextBox x:Name="PostalLocation" Grid.Column="1" TextChanged="PostalLocation_TextChanged"
 | 
			
		||||
                         Margin="10,30,10,10" Width="120" HorizontalAlignment="Left"/>
 | 
			
		||||
                <Label Content=", am" Margin="130,30,10,10" FontSize="14" Grid.Column="1"/>
 | 
			
		||||
                <TextBox x:Name="PostalDate" Grid.Column="1" Text="01.01.2020"
 | 
			
		||||
                         Margin="162,30,10,10" Width="78" HorizontalAlignment="Left"
 | 
			
		||||
                         TextChanged="Date_TextChanged" LostFocus="Date_LostFocus"/>
 | 
			
		||||
                    <GroupBox x:Name="DocumentBox" Header="Dokument" Margin="10,170,10,47" HorizontalAlignment="Stretch">
 | 
			
		||||
                        <Grid>
 | 
			
		||||
                            <Grid.ColumnDefinitions>
 | 
			
		||||
                                <ColumnDefinition Width="70"/>
 | 
			
		||||
                                <ColumnDefinition Width="*"/>
 | 
			
		||||
                            </Grid.ColumnDefinitions>
 | 
			
		||||
 | 
			
		||||
                <GroupBox Header="Adressaten" Margin="10,70,10,47" Grid.Column="1">
 | 
			
		||||
                    <Grid>
 | 
			
		||||
                        <RadioButton GroupName="Recipients" x:Name="RecipientsActiveMembersInput" Content="aktive Mitglieder"
 | 
			
		||||
                                     Margin="10,10,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                        <RadioButton GroupName="Recipients" x:Name="RecipientsAreaComMembersInput" Content="Mitglieder mit Flächenbindung"
 | 
			
		||||
                                     Margin="10,30,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                        <RadioButton GroupName="Recipients" x:Name="RecipientsDeliveryAncmtMembersInput" Content="Mitglieder mit Anmeldung"
 | 
			
		||||
                                     Margin="10,50,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                        <RadioButton GroupName="Recipients" x:Name="RecipientsDeliveryMembersInput" Content="Lieferanten der Saison"
 | 
			
		||||
                                     Margin="10,70,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                        <RadioButton GroupName="Recipients" x:Name="RecipientsNonDeliveryMembersInput" Content="Nicht-Lieferanten der Saison"
 | 
			
		||||
                                     Margin="10,90,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                        <RadioButton GroupName="Recipients" x:Name="RecipientsCustomInput" Content="Benutzerdefiniert"
 | 
			
		||||
                                     Margin="10,110,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                            <CheckBox x:Name="DocumentNonDeliverersInput" Content="Auch Nicht-Lieferanten miteinbeziehen"
 | 
			
		||||
                                      Margin="10,10,10,10" Grid.Column="1"/>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Zwst.:" x:Name="MemberBranchLabel" Margin="10,140,0,10"/>
 | 
			
		||||
                        <ctrl:CheckComboBox x:Name="MemberBranchInput" AllItemsSelectedContent="Alle Stammzweigstellen" Delimiter=", " DisplayMemberPath="Name"
 | 
			
		||||
                                            Margin="50,140,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                            SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
                            <Label x:Name="DocumentFooterLabel" Content="Fußtext:" Margin="10,40,0,10"/>
 | 
			
		||||
                            <TextBox x:Name="DeliveryConfirmationFooterInput" Grid.Column="1"
 | 
			
		||||
                                     Margin="0,40,10,10" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
 | 
			
		||||
                                     AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap"
 | 
			
		||||
                                     TextChanged="DocumentInput_TextChanged"/>
 | 
			
		||||
                            <TextBox x:Name="CreditNoteFooterInput" Grid.Column="1"
 | 
			
		||||
                                     Margin="0,10,10,10" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
 | 
			
		||||
                                     AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap"
 | 
			
		||||
                                     TextChanged="DocumentInput_TextChanged"/>
 | 
			
		||||
                        </Grid>
 | 
			
		||||
                    </GroupBox>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Gem.:" x:Name="MemberKgLabel" Margin="10,170,0,10"/>
 | 
			
		||||
                        <ctrl:CheckComboBox x:Name="MemberKgInput" AllItemsSelectedContent="Alle Stammgemeinden" Delimiter=", " DisplayMemberPath="Name"
 | 
			
		||||
                                            IsSelectAllActive="True" SelectAllContent="Alle Stammgemeinden"
 | 
			
		||||
                                            Margin="50,170,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                            SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
                    <TextBox x:Name="PostalLocation" Grid.Column="1" TextChanged="PostalLocation_TextChanged"
 | 
			
		||||
                             Margin="10,30,10,10" Width="120" HorizontalAlignment="Left"/>
 | 
			
		||||
                    <Label Content=", am" Margin="130,30,10,10" FontSize="14" Grid.Column="1"/>
 | 
			
		||||
                    <TextBox x:Name="PostalDate" Grid.Column="1" Text="01.01.2020"
 | 
			
		||||
                             Margin="162,30,10,10" Width="78" HorizontalAlignment="Left"
 | 
			
		||||
                             TextChanged="Date_TextChanged" LostFocus="Date_LostFocus"/>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Bio-Betrieb:" x:Name="MemberOrganicLabel" Margin="10,200,0,10"/>
 | 
			
		||||
                        <RadioButton x:Name="MemberOrganicYesInput" Content="Ja" GroupName="MemberOrganic"
 | 
			
		||||
                                     Margin="80,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="MemberInput_Checked"/>
 | 
			
		||||
                        <RadioButton x:Name="MemberOrganicNoInput" Content="Nein" GroupName="MemberOrganic"
 | 
			
		||||
                                     Margin="125,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="MemberInput_Checked"/>
 | 
			
		||||
                        <RadioButton x:Name="MemberOrganicIndifferentInput" Content="Egal" GroupName="MemberOrganic"
 | 
			
		||||
                                     Margin="180,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="MemberInput_Checked"/>
 | 
			
		||||
                    <GroupBox Header="Adressaten" Margin="10,70,10,47" Grid.Column="1">
 | 
			
		||||
                        <Grid>
 | 
			
		||||
                            <RadioButton GroupName="Recipients" x:Name="RecipientsActiveMembersInput" Content="aktive Mitglieder"
 | 
			
		||||
                                         Margin="10,10,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                            <RadioButton GroupName="Recipients" x:Name="RecipientsAreaComMembersInput" Content="Mitglieder mit Flächenbindung"
 | 
			
		||||
                                         Margin="10,30,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                            <RadioButton GroupName="Recipients" x:Name="RecipientsDeliveryAncmtMembersInput" Content="Mitglieder mit Anmeldung"
 | 
			
		||||
                                         Margin="10,50,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                            <RadioButton GroupName="Recipients" x:Name="RecipientsDeliveryMembersInput" Content="Lieferanten der Saison"
 | 
			
		||||
                                         Margin="10,70,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                            <RadioButton GroupName="Recipients" x:Name="RecipientsNonDeliveryMembersInput" Content="Nicht-Lieferanten der Saison"
 | 
			
		||||
                                         Margin="10,90,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
                            <RadioButton GroupName="Recipients" x:Name="RecipientsCustomInput" Content="Benutzerdefiniert"
 | 
			
		||||
                                         Margin="10,110,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="RecipientsInput_Changed" Unchecked="RecipientsInput_Changed"/>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Funktionär:" x:Name="MemberFunktionärLabel" Margin="10,230,0,10"/>
 | 
			
		||||
                        <RadioButton x:Name="MemberFunktionärYesInput" Content="Ja" GroupName="MemberFunktionär"
 | 
			
		||||
                                     Margin="80,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="MemberInput_Checked"/>
 | 
			
		||||
                        <RadioButton x:Name="MemberFunktionärNoInput" Content="Nein" GroupName="MemberFunktionär"
 | 
			
		||||
                                     Margin="125,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="MemberInput_Checked"/>
 | 
			
		||||
                        <RadioButton x:Name="MemberFunktionärIndifferentInput" Content="Egal" GroupName="MemberFunktionär"
 | 
			
		||||
                                     Margin="180,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                     Checked="MemberInput_Checked"/>
 | 
			
		||||
                            <Label Content="Zwst.:" x:Name="MemberBranchLabel" Margin="10,140,0,10"/>
 | 
			
		||||
                            <ctrl:CheckComboBox x:Name="MemberBranchInput" AllItemsSelectedContent="Alle Stammzweigstellen" Delimiter=", " DisplayMemberPath="Name"
 | 
			
		||||
                                                Margin="50,140,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                                SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Vtrg.:" x:Name="MemberAreaComLabel" Margin="10,260,0,10"/>
 | 
			
		||||
                        <ctrl:CheckComboBox x:Name="MemberAreaComInput" AllItemsSelectedContent="Alle Vertragsarten" Delimiter=", " DisplayMemberPath="VtrgId"
 | 
			
		||||
                                            IsSelectAllActive="True" SelectAllContent="Alle Vertragsarten"
 | 
			
		||||
                                            Margin="50,260,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                            SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
                            <Label Content="Gem.:" x:Name="MemberKgLabel" Margin="10,170,0,10"/>
 | 
			
		||||
                            <ctrl:CheckComboBox x:Name="MemberKgInput" AllItemsSelectedContent="Alle Stammgemeinden" Delimiter=", " DisplayMemberPath="Name"
 | 
			
		||||
                                                IsSelectAllActive="True" SelectAllContent="Alle Stammgemeinden"
 | 
			
		||||
                                                Margin="50,170,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                                SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Tag:" x:Name="MemberDeliveryAncmtLabel" Margin="10,260,0,10"/>
 | 
			
		||||
                        <ctrl:CheckComboBox x:Name="MemberDeliveryAncmtInput" AllItemsSelectedContent="Alle Lesepläne" Delimiter=", " DisplayMemberPath="Identifier"
 | 
			
		||||
                                            IsSelectAllActive="True" SelectAllContent="Alle Lesepläne"
 | 
			
		||||
                                            Margin="50,260,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                            SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
                            <Label Content="Bio-Betrieb:" x:Name="MemberOrganicLabel" Margin="10,200,0,10"/>
 | 
			
		||||
                            <RadioButton x:Name="MemberOrganicYesInput" Content="Ja" GroupName="MemberOrganic"
 | 
			
		||||
                                         Margin="80,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="MemberInput_Checked"/>
 | 
			
		||||
                            <RadioButton x:Name="MemberOrganicNoInput" Content="Nein" GroupName="MemberOrganic"
 | 
			
		||||
                                         Margin="125,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="MemberInput_Checked"/>
 | 
			
		||||
                            <RadioButton x:Name="MemberOrganicIndifferentInput" Content="Egal" GroupName="MemberOrganic"
 | 
			
		||||
                                         Margin="180,205,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="MemberInput_Checked"/>
 | 
			
		||||
 | 
			
		||||
                        <ctrl:CheckComboBox x:Name="MemberCustomInput" AllItemsSelectedContent="Alle Mitglieder" Delimiter=", " DisplayMemberPath="AdministrativeName"
 | 
			
		||||
                                            IsSelectAllActive="True" SelectAllContent="Alle Mitglieder"
 | 
			
		||||
                                            Margin="10,140,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                            SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
                    </Grid>
 | 
			
		||||
                </GroupBox>
 | 
			
		||||
                            <Label Content="Funktionär:" x:Name="MemberFunktionärLabel" Margin="10,230,0,10"/>
 | 
			
		||||
                            <RadioButton x:Name="MemberFunktionärYesInput" Content="Ja" GroupName="MemberFunktionär"
 | 
			
		||||
                                         Margin="80,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="MemberInput_Checked"/>
 | 
			
		||||
                            <RadioButton x:Name="MemberFunktionärNoInput" Content="Nein" GroupName="MemberFunktionär"
 | 
			
		||||
                                         Margin="125,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="MemberInput_Checked"/>
 | 
			
		||||
                            <RadioButton x:Name="MemberFunktionärIndifferentInput" Content="Egal" GroupName="MemberFunktionär"
 | 
			
		||||
                                         Margin="180,235,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                         Checked="MemberInput_Checked"/>
 | 
			
		||||
 | 
			
		||||
                <Button x:Name="ContinueButton" Content="Weiter" Grid.Column="1"
 | 
			
		||||
                        Margin="10,10,10,10" Height="27" Width="100" Padding="9,3" FontSize="14"
 | 
			
		||||
                        VerticalAlignment="Bottom" HorizontalAlignment="Right"
 | 
			
		||||
                        Click="ContinueButton_Click"/>
 | 
			
		||||
            </Grid>
 | 
			
		||||
        </TabItem>
 | 
			
		||||
                            <Label Content="Vtrg.:" x:Name="MemberAreaComLabel" Margin="10,260,0,10"/>
 | 
			
		||||
                            <ctrl:CheckComboBox x:Name="MemberAreaComInput" AllItemsSelectedContent="Alle Vertragsarten" Delimiter=", " DisplayMemberPath="VtrgId"
 | 
			
		||||
                                                IsSelectAllActive="True" SelectAllContent="Alle Vertragsarten"
 | 
			
		||||
                                                Margin="50,260,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                                SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
 | 
			
		||||
        <TabItem Header="Absenden" Visibility="Collapsed">
 | 
			
		||||
            <Grid>
 | 
			
		||||
                <Grid.ColumnDefinitions>
 | 
			
		||||
                    <ColumnDefinition Width="*"/>
 | 
			
		||||
                    <ColumnDefinition Width="1.5*"/>
 | 
			
		||||
                </Grid.ColumnDefinitions>
 | 
			
		||||
                <Grid.RowDefinitions>
 | 
			
		||||
                    <RowDefinition Height="*"/>
 | 
			
		||||
                    <RowDefinition Height="80"/>
 | 
			
		||||
                </Grid.RowDefinitions>
 | 
			
		||||
                            <Label Content="Tag:" x:Name="MemberDeliveryAncmtLabel" Margin="10,260,0,10"/>
 | 
			
		||||
                            <ctrl:CheckComboBox x:Name="MemberDeliveryAncmtInput" AllItemsSelectedContent="Alle Lesepläne" Delimiter=", " DisplayMemberPath="Identifier"
 | 
			
		||||
                                                IsSelectAllActive="True" SelectAllContent="Alle Lesepläne"
 | 
			
		||||
                                                Margin="50,260,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                                SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
 | 
			
		||||
                <GroupBox Header="Post" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,5,10" Grid.Column="0">
 | 
			
		||||
                    <Grid>
 | 
			
		||||
                        <GroupBox Header="Zusenden an..." Margin="10,10,10,10" Height="150" Width="220" VerticalAlignment="Top" HorizontalAlignment="Left">
 | 
			
		||||
                            <StackPanel>
 | 
			
		||||
                                <RadioButton x:Name="PostalAllInput" Margin="10,10,10,2.5" Click="PostalInput_Changed">
 | 
			
		||||
                                    <TextBlock>
 | 
			
		||||
                                        ...alle (<Run Text="{Binding Path=PostalAllCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                    </TextBlock>
 | 
			
		||||
                                </RadioButton>
 | 
			
		||||
                                <RadioButton x:Name="PostalWishInput" Margin="10,2.5,10,2.5" Click="PostalInput_Changed" IsChecked="True">
 | 
			
		||||
                                    <TextBlock>
 | 
			
		||||
                                        ...Mitglieder, die Zusendung<LineBreak/>
 | 
			
		||||
                                        per Post wünschen (<Run Text="{Binding Path=PostalWishCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                    </TextBlock>
 | 
			
		||||
                                </RadioButton>
 | 
			
		||||
                                <RadioButton x:Name="PostalNoEmailInput" Margin="10,2.5,10,2.5" Click="PostalInput_Changed">
 | 
			
		||||
                                    <TextBlock>
 | 
			
		||||
                                        ...Mitglieder, die keine<LineBreak/>
 | 
			
		||||
                                        E-Mail erhalten würden (<Run Text="{Binding Path=PostalNoEmailCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                    </TextBlock>
 | 
			
		||||
                                </RadioButton>
 | 
			
		||||
                                <RadioButton x:Name="PostalNobodyInput" Margin="10,2.5,10,10" Content="...niemanden (0)"  Click="PostalInput_Changed"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
                        </GroupBox>
 | 
			
		||||
                            <ctrl:CheckComboBox x:Name="MemberCustomInput" AllItemsSelectedContent="Alle Mitglieder" Delimiter=", " DisplayMemberPath="AdministrativeName"
 | 
			
		||||
                                                IsSelectAllActive="True" SelectAllContent="Alle Mitglieder"
 | 
			
		||||
                                                Margin="10,140,10,10" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="25"
 | 
			
		||||
                                                SelectionChanged="MemberInput_SelectionChanged"/>
 | 
			
		||||
                        </Grid>
 | 
			
		||||
                    </GroupBox>
 | 
			
		||||
 | 
			
		||||
                        <GroupBox Header="Sortieren nach" Margin="10,180,10,10" Width="180" Height="80" VerticalAlignment="Top" HorizontalAlignment="Left">
 | 
			
		||||
                            <StackPanel Margin="5,5,0,5">
 | 
			
		||||
                                <RadioButton GroupName="Order" x:Name="OrderMgNrInput" Content="Mitgliedsnummer" Click="OrderInput_Changed" IsChecked="True"/>
 | 
			
		||||
                                <RadioButton GroupName="Order" x:Name="OrderNameInput" Content="Name" Click="OrderInput_Changed"/>
 | 
			
		||||
                                <RadioButton GroupName="Order" x:Name="OrderPlzInput" Content="PLZ, Ort, Name" Click="OrderInput_Changed"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
                        </GroupBox>
 | 
			
		||||
                    <Button x:Name="ContinueButton" Content="Weiter" Grid.Column="1"
 | 
			
		||||
                            Margin="10,10,10,10" Height="27" Width="100" Padding="9,3" FontSize="14"
 | 
			
		||||
                            VerticalAlignment="Bottom" HorizontalAlignment="Right"
 | 
			
		||||
                            Click="ContinueButton_Click"/>
 | 
			
		||||
                </Grid>
 | 
			
		||||
            </TabItem>
 | 
			
		||||
 | 
			
		||||
                        <CheckBox x:Name="DoublePagedInput" Margin="20,270,10,10" Content="Doppelseitig drucken"
 | 
			
		||||
                                  VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                  Checked="DoublePagedInput_Changed" Unchecked="DoublePagedInput_Changed"/>
 | 
			
		||||
 | 
			
		||||
                        <TextBox x:Name="PostalSender1" TextChanged="PostalSender_TextChanged" IsEnabled="False"
 | 
			
		||||
                                 Margin="10,300,10,10"/>
 | 
			
		||||
                        <TextBox x:Name="PostalSender2" TextChanged="PostalSender_TextChanged"
 | 
			
		||||
                                 Margin="10,330,10,10"/>
 | 
			
		||||
                    </Grid>
 | 
			
		||||
                </GroupBox>
 | 
			
		||||
 | 
			
		||||
                <GroupBox Header="E-Mail" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,10,10,10" Grid.Column="1">
 | 
			
		||||
                    <Grid>
 | 
			
		||||
                        <GroupBox Header="Zusenden an..." Margin="80,10,10,10" Width="220" Height="110" VerticalAlignment="Top" HorizontalAlignment="Left">
 | 
			
		||||
                            <StackPanel>
 | 
			
		||||
                                <RadioButton x:Name="EmailAllInput" Margin="10,10,10,2.5" Checked="EmailInput_Changed">
 | 
			
		||||
                                    <TextBlock>
 | 
			
		||||
                                        ...alle mit E-Mail-Adressen (<Run Text="{Binding Path=EmailAllCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                    </TextBlock>
 | 
			
		||||
                                </RadioButton>
 | 
			
		||||
                                <RadioButton x:Name="EmailWishInput" Margin="10,2.5,10,2.5" IsChecked="True" Checked="EmailInput_Changed">
 | 
			
		||||
                                    <TextBlock>
 | 
			
		||||
                                            ...Mitglieder, die Zusendung<LineBreak/>
 | 
			
		||||
                                            per E-Mail wünschen (<Run Text="{Binding Path=EmailWishCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                    </TextBlock>
 | 
			
		||||
                                </RadioButton>
 | 
			
		||||
                                <RadioButton x:Name="EmailNobodyInput" Margin="10,2.5,10,10" Content="...niemanden (0)"  Checked="EmailInput_Changed"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
                        </GroupBox>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Betreff:" Margin="10,130,10,10"/>
 | 
			
		||||
                        <TextBox x:Name="EmailSubjectInput" Margin="80,130,10,10"/>
 | 
			
		||||
 | 
			
		||||
                        <Label Content="Nachricht:" Margin="10,160,10,10"/>
 | 
			
		||||
                        <TextBox x:Name="EmailBodyInput"
 | 
			
		||||
                                 Margin="80,160,10,10" VerticalAlignment="Stretch" Height="Auto"
 | 
			
		||||
                                 TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" AcceptsReturn="True"/>
 | 
			
		||||
                    </Grid>
 | 
			
		||||
                </GroupBox>
 | 
			
		||||
 | 
			
		||||
                <Grid Grid.Row="1" Grid.ColumnSpan="2" Width="400" Height="59">
 | 
			
		||||
            <TabItem Header="Absenden" Visibility="Collapsed">
 | 
			
		||||
                <Grid>
 | 
			
		||||
                    <Grid.ColumnDefinitions>
 | 
			
		||||
                        <ColumnDefinition Width="0.7*"/>
 | 
			
		||||
                        <ColumnDefinition Width="10"/>
 | 
			
		||||
                        <ColumnDefinition Width="0.4*"/>
 | 
			
		||||
                        <ColumnDefinition Width="5"/>
 | 
			
		||||
                        <ColumnDefinition Width="0.6*"/>
 | 
			
		||||
                        <ColumnDefinition Width="*"/>
 | 
			
		||||
                        <ColumnDefinition Width="1.5*"/>
 | 
			
		||||
                    </Grid.ColumnDefinitions>
 | 
			
		||||
                    <Grid.RowDefinitions>
 | 
			
		||||
                        <RowDefinition Height="*"/>
 | 
			
		||||
                        <RowDefinition Height="5"/>
 | 
			
		||||
                        <RowDefinition Height="*"/>
 | 
			
		||||
                        <RowDefinition Height="80"/>
 | 
			
		||||
                    </Grid.RowDefinitions>
 | 
			
		||||
 | 
			
		||||
                    <Button x:Name="GenerateButton" Content="Generieren"
 | 
			
		||||
                            Grid.Row="0" Grid.Column="0" FontSize="14"
 | 
			
		||||
                            Click="GenerateButton_Click"/>
 | 
			
		||||
                    <ProgressBar x:Name="ProgressBar"
 | 
			
		||||
                                 Grid.Row="2" Grid.Column="0" SnapsToDevicePixels="True"/>
 | 
			
		||||
                    <GroupBox Header="Post" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,5,10" Grid.Column="0">
 | 
			
		||||
                        <Grid>
 | 
			
		||||
                            <GroupBox Header="Zusenden an..." Margin="10,10,10,10" Height="150" Width="220" VerticalAlignment="Top" HorizontalAlignment="Left">
 | 
			
		||||
                                <StackPanel>
 | 
			
		||||
                                    <RadioButton x:Name="PostalAllInput" Margin="10,10,10,2.5" Click="PostalInput_Changed">
 | 
			
		||||
                                        <TextBlock>
 | 
			
		||||
                                            ...alle (<Run Text="{Binding Path=PostalAllCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                        </TextBlock>
 | 
			
		||||
                                    </RadioButton>
 | 
			
		||||
                                    <RadioButton x:Name="PostalWishInput" Margin="10,2.5,10,2.5" Click="PostalInput_Changed" IsChecked="True">
 | 
			
		||||
                                        <TextBlock>
 | 
			
		||||
                                            ...Mitglieder, die Zusendung<LineBreak/>
 | 
			
		||||
                                            per Post wünschen (<Run Text="{Binding Path=PostalWishCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                        </TextBlock>
 | 
			
		||||
                                    </RadioButton>
 | 
			
		||||
                                    <RadioButton x:Name="PostalNoEmailInput" Margin="10,2.5,10,2.5" Click="PostalInput_Changed">
 | 
			
		||||
                                        <TextBlock>
 | 
			
		||||
                                            ...Mitglieder, die keine<LineBreak/>
 | 
			
		||||
                                            E-Mail erhalten würden (<Run Text="{Binding Path=PostalNoEmailCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                        </TextBlock>
 | 
			
		||||
                                    </RadioButton>
 | 
			
		||||
                                    <RadioButton x:Name="PostalNobodyInput" Margin="10,2.5,10,10" Content="...niemanden (0)"  Click="PostalInput_Changed"/>
 | 
			
		||||
                                </StackPanel>
 | 
			
		||||
                            </GroupBox>
 | 
			
		||||
 | 
			
		||||
                    <Button x:Name="PreviewButton" Content="Vorschau" IsEnabled="False"
 | 
			
		||||
                            Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="3" FontSize="14"
 | 
			
		||||
                            Click="PreviewButton_Click"/>
 | 
			
		||||
                    <Button x:Name="PrintButton" Content="Drucken" IsEnabled="False"
 | 
			
		||||
                            Grid.Row="2" Grid.Column="2" FontSize="14"
 | 
			
		||||
                            Click="PrintButton_Click"/>
 | 
			
		||||
                    <Button x:Name="EmailButton" Content="E-Mails verschicken" IsEnabled="False"
 | 
			
		||||
                            Grid.Row="2" Grid.Column="4" FontSize="14"
 | 
			
		||||
                            Click="EmailButton_Click"/>
 | 
			
		||||
                            <GroupBox Header="Sortieren nach" Margin="10,180,10,10" Width="180" Height="80" VerticalAlignment="Top" HorizontalAlignment="Left">
 | 
			
		||||
                                <StackPanel Margin="5,5,0,5">
 | 
			
		||||
                                    <RadioButton GroupName="Order" x:Name="OrderMgNrInput" Content="Mitgliedsnummer" Click="OrderInput_Changed" IsChecked="True"/>
 | 
			
		||||
                                    <RadioButton GroupName="Order" x:Name="OrderNameInput" Content="Name" Click="OrderInput_Changed"/>
 | 
			
		||||
                                    <RadioButton GroupName="Order" x:Name="OrderPlzInput" Content="PLZ, Ort, Name" Click="OrderInput_Changed"/>
 | 
			
		||||
                                </StackPanel>
 | 
			
		||||
                            </GroupBox>
 | 
			
		||||
 | 
			
		||||
                            <CheckBox x:Name="DoublePagedInput" Margin="20,270,10,10" Content="Doppelseitig drucken"
 | 
			
		||||
                                      VerticalAlignment="Top" HorizontalAlignment="Left"
 | 
			
		||||
                                      Checked="DoublePagedInput_Changed" Unchecked="DoublePagedInput_Changed"/>
 | 
			
		||||
 | 
			
		||||
                            <TextBox x:Name="PostalSender1" TextChanged="PostalSender_TextChanged" IsEnabled="False"
 | 
			
		||||
                                     Margin="10,300,10,10"/>
 | 
			
		||||
                            <TextBox x:Name="PostalSender2" TextChanged="PostalSender_TextChanged"
 | 
			
		||||
                                     Margin="10,330,10,10"/>
 | 
			
		||||
                        </Grid>
 | 
			
		||||
                    </GroupBox>
 | 
			
		||||
 | 
			
		||||
                    <GroupBox Header="E-Mail" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,10,10,10" Grid.Column="1">
 | 
			
		||||
                        <Grid>
 | 
			
		||||
                            <GroupBox Header="Zusenden an..." Margin="80,10,10,10" Width="220" Height="110" VerticalAlignment="Top" HorizontalAlignment="Left">
 | 
			
		||||
                                <StackPanel>
 | 
			
		||||
                                    <RadioButton x:Name="EmailAllInput" Margin="10,10,10,2.5" Checked="EmailInput_Changed">
 | 
			
		||||
                                        <TextBlock>
 | 
			
		||||
                                            ...alle mit E-Mail-Adressen (<Run Text="{Binding Path=EmailAllCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                        </TextBlock>
 | 
			
		||||
                                    </RadioButton>
 | 
			
		||||
                                    <RadioButton x:Name="EmailWishInput" Margin="10,2.5,10,2.5" IsChecked="True" Checked="EmailInput_Changed">
 | 
			
		||||
                                        <TextBlock>
 | 
			
		||||
                                            ...Mitglieder, die Zusendung<LineBreak/>
 | 
			
		||||
                                            per E-Mail wünschen (<Run Text="{Binding Path=EmailWishCount, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>)
 | 
			
		||||
                                        </TextBlock>
 | 
			
		||||
                                    </RadioButton>
 | 
			
		||||
                                    <RadioButton x:Name="EmailNobodyInput" Margin="10,2.5,10,10" Content="...niemanden (0)"  Checked="EmailInput_Changed"/>
 | 
			
		||||
                                </StackPanel>
 | 
			
		||||
                            </GroupBox>
 | 
			
		||||
 | 
			
		||||
                            <Label Content="Betreff:" Margin="10,130,10,10"/>
 | 
			
		||||
                            <TextBox x:Name="EmailSubjectInput" Margin="80,130,10,10"/>
 | 
			
		||||
 | 
			
		||||
                            <Label Content="Nachricht:" Margin="10,160,10,10"/>
 | 
			
		||||
                            <TextBox x:Name="EmailBodyInput"
 | 
			
		||||
                                     Margin="80,160,10,10" VerticalAlignment="Stretch" Height="Auto"
 | 
			
		||||
                                     TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" AcceptsReturn="True"/>
 | 
			
		||||
                        </Grid>
 | 
			
		||||
                    </GroupBox>
 | 
			
		||||
 | 
			
		||||
                    <Grid Grid.Row="1" Grid.ColumnSpan="2" Width="400" Height="59">
 | 
			
		||||
                        <Grid.ColumnDefinitions>
 | 
			
		||||
                            <ColumnDefinition Width="0.7*"/>
 | 
			
		||||
                            <ColumnDefinition Width="10"/>
 | 
			
		||||
                            <ColumnDefinition Width="0.4*"/>
 | 
			
		||||
                            <ColumnDefinition Width="5"/>
 | 
			
		||||
                            <ColumnDefinition Width="0.6*"/>
 | 
			
		||||
                        </Grid.ColumnDefinitions>
 | 
			
		||||
                        <Grid.RowDefinitions>
 | 
			
		||||
                            <RowDefinition Height="*"/>
 | 
			
		||||
                            <RowDefinition Height="5"/>
 | 
			
		||||
                            <RowDefinition Height="*"/>
 | 
			
		||||
                        </Grid.RowDefinitions>
 | 
			
		||||
 | 
			
		||||
                        <Button x:Name="GenerateButton" Content="Generieren"
 | 
			
		||||
                                Grid.Row="0" Grid.Column="0" FontSize="14"
 | 
			
		||||
                                Click="GenerateButton_Click"/>
 | 
			
		||||
                        <ProgressBar x:Name="ProgressBar"
 | 
			
		||||
                                     Grid.Row="2" Grid.Column="0" SnapsToDevicePixels="True"/>
 | 
			
		||||
 | 
			
		||||
                        <Button x:Name="PreviewButton" Content="Vorschau" IsEnabled="False"
 | 
			
		||||
                                Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="3" FontSize="14"
 | 
			
		||||
                                Click="PreviewButton_Click"/>
 | 
			
		||||
                        <Button x:Name="PrintButton" Content="Drucken" IsEnabled="False"
 | 
			
		||||
                                Grid.Row="2" Grid.Column="2" FontSize="14"
 | 
			
		||||
                                Click="PrintButton_Click"/>
 | 
			
		||||
                        <Button x:Name="EmailButton" Content="E-Mails verschicken" IsEnabled="False"
 | 
			
		||||
                                Grid.Row="2" Grid.Column="4" FontSize="14"
 | 
			
		||||
                                Click="EmailButton_Click"/>
 | 
			
		||||
                    </Grid>
 | 
			
		||||
 | 
			
		||||
                    <Button x:Name="BackButton" Content="Zurück" Grid.Row="1"
 | 
			
		||||
                            Margin="10,10,10,10" Height="27" Width="100" Padding="9,3" FontSize="14"
 | 
			
		||||
                            VerticalAlignment="Bottom" HorizontalAlignment="Left"
 | 
			
		||||
                            Click="BackButton_Click"/>
 | 
			
		||||
                </Grid>
 | 
			
		||||
            </TabItem>
 | 
			
		||||
        </TabControl>
 | 
			
		||||
 | 
			
		||||
                <Button x:Name="BackButton" Content="Zurück" Grid.Row="1"
 | 
			
		||||
                        Margin="10,10,10,10" Height="27" Width="100" Padding="9,3" FontSize="14"
 | 
			
		||||
                        VerticalAlignment="Bottom" HorizontalAlignment="Left"
 | 
			
		||||
                        Click="BackButton_Click"/>
 | 
			
		||||
            </Grid>
 | 
			
		||||
        </TabItem>
 | 
			
		||||
    </TabControl>
 | 
			
		||||
        <StatusBar Grid.Row="2" BorderThickness="0,1,0,0" BorderBrush="Gray">
 | 
			
		||||
            <StatusBar.ItemsPanel>
 | 
			
		||||
                <ItemsPanelTemplate>
 | 
			
		||||
                    <Grid>
 | 
			
		||||
                        <Grid.ColumnDefinitions>
 | 
			
		||||
                            <ColumnDefinition Width="1*"/>
 | 
			
		||||
                            <ColumnDefinition Width="Auto"/>
 | 
			
		||||
                            <ColumnDefinition Width="1*"/>
 | 
			
		||||
                            <ColumnDefinition Width="Auto"/>
 | 
			
		||||
                            <ColumnDefinition Width="1*"/>
 | 
			
		||||
                        </Grid.ColumnDefinitions>
 | 
			
		||||
                    </Grid>
 | 
			
		||||
                </ItemsPanelTemplate>
 | 
			
		||||
            </StatusBar.ItemsPanel>
 | 
			
		||||
            <StatusBarItem>
 | 
			
		||||
                <TextBlock>
 | 
			
		||||
                    Adressaten: <Run x:Name="StatusRecipients" Text="0"/>
 | 
			
		||||
                </TextBlock>
 | 
			
		||||
            </StatusBarItem>
 | 
			
		||||
            <Separator Grid.Column="1"/>
 | 
			
		||||
            <StatusBarItem Grid.Column="2">
 | 
			
		||||
                <TextBlock>
 | 
			
		||||
                    Adressaten (Post): <Run x:Name="StatusPostalRecipients" Text="0"/>
 | 
			
		||||
                </TextBlock>
 | 
			
		||||
            </StatusBarItem>
 | 
			
		||||
            <Separator Grid.Column="3"/>
 | 
			
		||||
            <StatusBarItem Grid.Column="4">
 | 
			
		||||
                <TextBlock>
 | 
			
		||||
                    Adressaten (E-Mail): <Run x:Name="StatusEmailRecipients" Text="0"/>
 | 
			
		||||
                </TextBlock>
 | 
			
		||||
            </StatusBarItem>
 | 
			
		||||
        </StatusBar>
 | 
			
		||||
    </Grid>
 | 
			
		||||
</local:ContextWindow>
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,7 @@ namespace Elwig.Windows {
 | 
			
		||||
        public IEnumerable<Member> Recipients = [];
 | 
			
		||||
 | 
			
		||||
        protected Document? PrintDocument;
 | 
			
		||||
        protected Dictionary<Member, List<Document>>? PrintMemberDocuments;
 | 
			
		||||
        protected Dictionary<Member, List<Document>>? EmailDocuments;
 | 
			
		||||
 | 
			
		||||
        public static readonly DependencyProperty PostalAllCountProperty = DependencyProperty.Register(nameof(PostalAllCount), typeof(int), typeof(MailWindow));
 | 
			
		||||
@@ -262,6 +263,11 @@ namespace Elwig.Windows {
 | 
			
		||||
                rb.IsEnabled = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void Menu_Help_Log_Click(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            var w = new MailLogWindow();
 | 
			
		||||
            w.Show();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ContinueButton_Click(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            TabControl.SelectedIndex = 1;
 | 
			
		||||
            TabControl.AllowDrop = false;
 | 
			
		||||
@@ -477,6 +483,12 @@ namespace Elwig.Windows {
 | 
			
		||||
            PostalWishCount = Recipients.Count(m => m.ContactViaPost);
 | 
			
		||||
            var countEmail = (modeEmail == 2 ? EmailAllCount : modeEmail == 1 ? EmailWishCount : 0);
 | 
			
		||||
            PostalNoEmailCount = PostalAllCount - countEmail;
 | 
			
		||||
            var countPostal = (modePostal == 3 ? PostalAllCount : modePostal == 2 ? PostalWishCount : modePostal == 1 ? PostalNoEmailCount : 0);
 | 
			
		||||
            if (IsLoaded) {
 | 
			
		||||
                StatusRecipients.Text = $"{Recipients.Count():N0}";
 | 
			
		||||
                StatusPostalRecipients.Text = $"{countPostal:N0}";
 | 
			
		||||
                StatusEmailRecipients.Text = $"{countEmail:N0}";
 | 
			
		||||
            }
 | 
			
		||||
            ResetDocuments();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -763,11 +775,13 @@ namespace Elwig.Windows {
 | 
			
		||||
                EmailDocuments = email;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var printDocs = memberDocs
 | 
			
		||||
            var printMemberDocs = memberDocs
 | 
			
		||||
                .Where(d =>
 | 
			
		||||
                    printMode == 3 ||
 | 
			
		||||
                    (printMode == 2 && d.Member.ContactViaPost) ||
 | 
			
		||||
                    (printMode == 1 && !emailRecipients.Contains(d.Member.MgNr)))
 | 
			
		||||
                .ToList();
 | 
			
		||||
            var printDocs = printMemberDocs
 | 
			
		||||
                .SelectMany(m => {
 | 
			
		||||
                    var docs = m.Docs.Select(d => d.Doc).ToList();
 | 
			
		||||
                    if (docs.Count == 0 || m.Docs[0].Type == DocType.Custom) {
 | 
			
		||||
@@ -792,6 +806,7 @@ namespace Elwig.Windows {
 | 
			
		||||
                        ProgressBar.Value = 100.0 * emailNum / totalNum + v * printNum / totalNum;
 | 
			
		||||
                    }));
 | 
			
		||||
                    PrintDocument = print;
 | 
			
		||||
                    PrintMemberDocuments = printMemberDocs.ToDictionary(m => m.Member, m => m.Docs.Select(d => d.Doc).ToList());
 | 
			
		||||
                } catch (Exception exc) {
 | 
			
		||||
                    MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
 | 
			
		||||
                    UnlockInputs();
 | 
			
		||||
@@ -801,6 +816,7 @@ namespace Elwig.Windows {
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                PrintDocument = null;
 | 
			
		||||
                PrintMemberDocuments = null;
 | 
			
		||||
            }
 | 
			
		||||
            ProgressBar.Value = 100.0;
 | 
			
		||||
 | 
			
		||||
@@ -837,7 +853,7 @@ namespace Elwig.Windows {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private async void PrintButton_Click(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            if (PrintDocument == null) return;
 | 
			
		||||
            if (PrintDocument == null || PrintMemberDocuments == null) return;
 | 
			
		||||
 | 
			
		||||
            PrintButton.IsEnabled = false;
 | 
			
		||||
            GenerateButton.IsEnabled = false;
 | 
			
		||||
@@ -851,6 +867,14 @@ namespace Elwig.Windows {
 | 
			
		||||
                    PrintDocument.Show();
 | 
			
		||||
                } else {
 | 
			
		||||
                    await PrintDocument.Print();
 | 
			
		||||
                    await Utils.AddSentMails(
 | 
			
		||||
                        PrintMemberDocuments.Select(d => (
 | 
			
		||||
                            "postal", d.Key.MgNr, d.Key.AdministrativeName,
 | 
			
		||||
                            new string[] { d.Value.Select(d => (d as BusinessDocument)?.Address).FirstOrDefault(a => a != null) ?? d.Key.FullAddress },
 | 
			
		||||
                            d.Value.Select(d => d.Title).FirstOrDefault("Briefkopf"),
 | 
			
		||||
                            d.Value.Select(d => d.Title).ToArray()
 | 
			
		||||
                        ))
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
                Mouse.OverrideCursor = null;
 | 
			
		||||
            }
 | 
			
		||||
@@ -882,6 +906,7 @@ namespace Elwig.Windows {
 | 
			
		||||
                Mouse.OverrideCursor = Cursors.AppStarting;
 | 
			
		||||
                var subject = EmailSubjectInput.Text;
 | 
			
		||||
                var text = EmailBodyInput.Text;
 | 
			
		||||
                await Utils.AddSentMailBody(subject, text, EmailDocuments.Count);
 | 
			
		||||
                foreach (var (m, docs) in EmailDocuments) {
 | 
			
		||||
                    using var msg = new MimeMessage();
 | 
			
		||||
                    msg.From.Add(new MailboxAddress(App.Client.NameFull, App.Config.Smtp.Value.From));
 | 
			
		||||
@@ -896,6 +921,12 @@ namespace Elwig.Windows {
 | 
			
		||||
                    }
 | 
			
		||||
                    msg.Body = body;
 | 
			
		||||
                    await client!.SendAsync(msg);
 | 
			
		||||
                    await Utils.AddSentMails([(
 | 
			
		||||
                        "email", m.MgNr, m.AdministrativeName,
 | 
			
		||||
                        m.EmailAddresses.OrderBy(a => a.Nr).Select(a => a.Address).ToArray(),
 | 
			
		||||
                        subject,
 | 
			
		||||
                        docs.Select(d => d.Title).ToArray()
 | 
			
		||||
                    )]);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                MessageBox.Show("Erfolgreich alle E-Mails verschickt!", "Rundschreiben verschicken", MessageBoxButton.OK, MessageBoxImage.Information);
 | 
			
		||||
@@ -944,7 +975,7 @@ namespace Elwig.Windows {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void PostalInput_Changed(object sender, RoutedEventArgs evt) {
 | 
			
		||||
            ResetDocuments();
 | 
			
		||||
            UpdatePostalEmailRecipients();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void OrderInput_Changed(object sender, RoutedEventArgs evt) {
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ namespace Elwig.Windows {
 | 
			
		||||
                (PhoneNr9TypeInput, PhoneNr9Input, PhoneNr9CommentInput),
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
            InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            ControlUtils.InitializeDelayTimer(SearchInput, SearchInput_TextChanged);
 | 
			
		||||
            SearchInput.TextChanged -= SearchInput_TextChanged;
 | 
			
		||||
 | 
			
		||||
            ViewModel.MemberListOrderByMgNr = false;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user