diff --git a/Logof Client.csproj b/Logof Client.csproj index 28addc8..37d59b8 100644 --- a/Logof Client.csproj +++ b/Logof Client.csproj @@ -71,4 +71,11 @@ + + + + PreviewWindow.axaml + Code + + diff --git a/MainWindow.axaml b/MainWindow.axaml index 62b39c3..c7c2c33 100644 --- a/MainWindow.axaml +++ b/MainWindow.axaml @@ -79,6 +79,14 @@ + + + + + + + diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index 7f5b81f..4642944 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -1377,4 +1377,14 @@ public partial class MainWindow : Window BtnCombineAddressSetSortUp.IsEnabled = true; } } + + private void MnIAdSetView_OnClick(object? sender, RoutedEventArgs e) + { + if (LstCustomerAdressSets.SelectedItems.Count > 0) + { + var preview = new PreviewWindow((LstCustomerAdressSets.SelectedItems[0] as KasAddressList).KasPersons); + preview.Show(); + + } + } } diff --git a/PreviewWindow.axaml b/PreviewWindow.axaml new file mode 100644 index 0000000..0926fdb --- /dev/null +++ b/PreviewWindow.axaml @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PreviewWindow.axaml.cs b/PreviewWindow.axaml.cs new file mode 100644 index 0000000..aed2fda --- /dev/null +++ b/PreviewWindow.axaml.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Layout; +using Avalonia.Media; + +namespace Logof_Client; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +public partial class PreviewWindow : Window, INotifyPropertyChanged +{ + public ObservableCollection Addresses { get; } + + private KasPerson? _selectedAddress; + + public KasPerson? SelectedAddress + { + get => _selectedAddress; + set + { + _selectedAddress = value; + PropertyChanged?.Invoke( + this, + new PropertyChangedEventArgs(nameof(SelectedAddress))); + } + } + + public event PropertyChangedEventHandler? PropertyChanged; + + public PreviewWindow(IEnumerable addresses) + { + InitializeComponent(); + + Addresses = new ObservableCollection(addresses); + + DataContext = this; + } + + private void Window_OnClosing(object? sender, WindowClosingEventArgs e) + { + Settings.Save(); + Global.Save(); + } +} + diff --git a/ResultWindow.axaml b/ResultWindow.axaml index 49792b0..e97e4cb 100644 --- a/ResultWindow.axaml +++ b/ResultWindow.axaml @@ -45,7 +45,7 @@ - + diff --git a/ResultWindow.axaml.cs b/ResultWindow.axaml.cs index 96f687d..19d5a02 100644 --- a/ResultWindow.axaml.cs +++ b/ResultWindow.axaml.cs @@ -230,7 +230,20 @@ public partial class ResultWindow : Window, INotifyPropertyChanged private void BtnShowSelected_OnClick(object? sender, RoutedEventArgs e) { - // once upon a time, there was a feature like this + if (LbResults.SelectedItems.Count > 0) + { + var selectedPersons = LbResults.SelectedItems + .Cast() + .Select(x => x.Person) + .ToList(); + + if (selectedPersons.Count == 0) + return; + + var preview = new PreviewWindow(selectedPersons); + preview.Show(); + + } } private void BtnExecuteFilter_OnClick(object? sender, RoutedEventArgs e)