Add Pdf.Display, Rename ActiveMemberInput

This commit is contained in:
2023-03-05 00:35:55 +01:00
parent 4c8f6e8cdc
commit 342c7b92bd
4 changed files with 36 additions and 14 deletions

View File

@ -30,5 +30,12 @@ namespace WGneu.Print {
await page.WaitForFunctionAsync("() => window.finished");
await page.PdfAsync(path_pdf);
}
public static void Display(string path) {
Process.Start(new ProcessStartInfo() {
FileName = path,
UseShellExecute = true,
});
}
}
}

View File

@ -12,10 +12,7 @@ namespace WGneu.Print {
public static async void Test() {
await Pdf.Convert(ROOT + "din-5008.html", ROOT + "test.pdf");
Process.Start(new ProcessStartInfo() {
FileName = ROOT + "test.pdf",
UseShellExecute = true,
});
Pdf.Display(ROOT + "test.pdf");
}
}
}

View File

@ -75,7 +75,8 @@
<TextBox x:Name="SearchInput" Grid.ColumnSpan="3" Margin="10,7,145,0" IsReadOnly="False"
TextChanged="SearchInput_TextChanged"/>
<CheckBox x:Name="AktiveMitgliederInput" Content="Nur aktive anzeigen" Checked="ActiveMemberCheckBox_Changed" Unchecked="ActiveMemberCheckBox_Changed"
<CheckBox x:Name="ActiveMemberInput" Content="Nur aktive anzeigen"
Checked="ActiveMemberInput_Changed" Unchecked="ActiveMemberInput_Changed"
HorizontalAlignment="Left" Margin="90,12,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2"/>
<DataGrid x:Name="MemberList" AutoGenerateColumns="False" HeadersVisibility="Column" IsReadOnly="True" GridLinesVisibility="None" SelectionMode="Single"
CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False"
@ -100,7 +101,7 @@
<Button x:Name="ResetButton" Content="Zurücksetzen" Click="ResetButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,10,0,10" Width="100" Grid.Column="1"/>
<Button x:Name="CancelButton" Content="Abbrechen" Click="CancelButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,10,10,10" FontSize="14" Padding="3,3,3,3" Width="100" Height="27" Grid.Column="2"/>
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,10,10,10" Width="100" Grid.Column="2"/>
</Grid>
<GroupBox Header="Persönliche Daten" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Margin="5,5,5,5">

View File

@ -38,7 +38,7 @@ namespace WGneu.Windows {
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
AktiveMitgliederInput.IsChecked = true;
ActiveMemberInput.IsChecked = true;
BranchInput.ItemsSource = Context.Branches.OrderBy(b => b.Name).ToList();
DefaultKgInput.ItemsSource = Context.WbKgs.Select(k => k.Kg).OrderBy(k => k.Name).ToList();
}
@ -63,8 +63,11 @@ namespace WGneu.Windows {
private void RefreshMemberList() {
Context.Members.Load();
List<Member> members = AktiveMitgliederInput.IsChecked.Value ? Context.Members.Where(m => m.Active).ToList() : Context.Members.ToList();
IQueryable<Member> memberQuery = Context.Members;
if (ActiveMemberInput.IsChecked == true)
memberQuery = memberQuery.Where(m => m.Active);
List<Member> members = memberQuery.ToList();
members = members.OrderBy(m => m.FamilyName + " " + m.GivenName).ToList();
if (TextFilter.Count > 0) {
@ -88,7 +91,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
Utils.ClearInputState(cb);
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
if (cb.Name != "AktiveMitgliederInput") Utils.ClearInputState(cb);
if (cb.Name != "ActiveMemberInput") Utils.ClearInputState(cb);
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
Utils.ClearInputState(rb);
}
@ -116,7 +119,7 @@ namespace WGneu.Windows {
RefreshInputs();
}
private void ActiveMemberCheckBox_Changed(object sender, RoutedEventArgs e) {
private void ActiveMemberInput_Changed(object sender, RoutedEventArgs e) {
RefreshMemberList();
}
@ -127,6 +130,7 @@ namespace WGneu.Windows {
HideNewEditDeleteButtons();
ShowSaveResetCancelButtons();
UnlockInputs();
LockSearchInputs();
}
private void EditMemberButton_Click(object sender, RoutedEventArgs e) {
@ -139,6 +143,7 @@ namespace WGneu.Windows {
HideNewEditDeleteButtons();
ShowSaveResetCancelButtons();
UnlockInputs();
LockSearchInputs();
}
private void DeleteMemberButton_Click(object sender, RoutedEventArgs e) {
@ -221,6 +226,7 @@ namespace WGneu.Windows {
HideSaveResetCancelButtons();
ShowNewEditDeleteButtons();
LockInputs();
UnlockSearchInputs();
RefreshMemberList();
}
@ -241,6 +247,7 @@ namespace WGneu.Windows {
ShowNewEditDeleteButtons();
RefreshInputs();
LockInputs();
UnlockSearchInputs();
}
private void SearchInput_TextChanged(object sender, RoutedEventArgs e) {
@ -303,7 +310,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = false;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
cb.IsEnabled = cb.Name == "AktiveMitgliederInput" ? true : false;
if (cb.Name != "ActiveMemberInput") cb.IsEnabled = false;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = false;
}
@ -314,11 +321,21 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = true;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
cb.IsEnabled = cb.Name == "AktiveMitgliederInput" ? false : true;
if (cb.Name != "ActiveMemberInput") cb.IsEnabled = true;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = true;
}
private void LockSearchInputs() {
SearchInput.IsEnabled = false;
ActiveMemberInput.IsEnabled = false;
}
private void UnlockSearchInputs() {
SearchInput.IsEnabled = true;
ActiveMemberInput.IsEnabled = true;
}
private void FillInputs(Member m) {
OriginalValues.Clear();
@ -375,7 +392,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
OriginalValues[cb] = cb.SelectedItem;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
if (cb.Name != "AktiveMitgliederInput") OriginalValues[cb] = (cb.IsChecked ?? false) ? bool.TrueString : null;
if (cb.Name != "ActiveMemberInput") OriginalValues[cb] = (cb.IsChecked ?? false) ? bool.TrueString : null;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
OriginalValues[rb] = (rb.IsChecked ?? false) ? bool.TrueString : null;
}
@ -386,7 +403,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.SelectedItem = null;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
if (cb.Name != "AktiveMitgliederInput") cb.IsChecked = false;
if (cb.Name != "ActiveMemberInput") cb.IsChecked = false;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsChecked = false;
OriginalValues.Clear();