diff --git a/Pf2eDataScrapper/WPF/EntityViewer/Component/EntityListControl.xaml b/Pf2eDataScrapper/WPF/EntityViewer/Component/EntityListControl.xaml
index 7ba545e..88ee49e 100644
--- a/Pf2eDataScrapper/WPF/EntityViewer/Component/EntityListControl.xaml
+++ b/Pf2eDataScrapper/WPF/EntityViewer/Component/EntityListControl.xaml
@@ -27,7 +27,7 @@
@@ -35,7 +35,7 @@
@@ -43,7 +43,7 @@
@@ -51,7 +51,7 @@
diff --git a/Pf2eDataScrapper/WPF/EntityViewer/Component/EntityListControl.xaml.cs b/Pf2eDataScrapper/WPF/EntityViewer/Component/EntityListControl.xaml.cs
index a9742d7..ef4b466 100644
--- a/Pf2eDataScrapper/WPF/EntityViewer/Component/EntityListControl.xaml.cs
+++ b/Pf2eDataScrapper/WPF/EntityViewer/Component/EntityListControl.xaml.cs
@@ -8,16 +8,6 @@ namespace Pf2eDataScrapper.WPF.EntityViewer.Component;
///
internal partial class EntityListControl : System.Windows.Controls.UserControl
{
- public EntityListViewModel? ViewModel
- {
- get => _viewModel;
- set
- {
- _viewModel = value;
- DataContext = ViewModel;
- }
- }
-
private EntityListViewModel? _viewModel;
public EntityListControl()
@@ -29,22 +19,22 @@ internal partial class EntityListControl : System.Windows.Controls.UserControl
private void FirstButton_OnClick(object sender, RoutedEventArgs e)
{
- ViewModel?.FirstPage();
+ // DataContext?.FirstPage();
}
private void PreviousButton_OnClick(object sender, RoutedEventArgs e)
{
- ViewModel?.PreviousPage();
+ //ViewModel?.PreviousPage();
}
private void NextButton_OnClick(object sender, RoutedEventArgs e)
{
- ViewModel?.NextPage();
+ //ViewModel?.NextPage();
}
private void LastButton_OnClick(object sender, RoutedEventArgs e)
{
- ViewModel?.LastPage();
+ //ViewModel?.LastPage();
}
private void TextBox_PreviewTextInput(
diff --git a/Pf2eDataScrapper/WPF/EntityViewer/EntityViewStructure/StructureRow.cs b/Pf2eDataScrapper/WPF/EntityViewer/EntityViewStructure/StructureRow.cs
index e1a8665..f2d2b25 100644
--- a/Pf2eDataScrapper/WPF/EntityViewer/EntityViewStructure/StructureRow.cs
+++ b/Pf2eDataScrapper/WPF/EntityViewer/EntityViewStructure/StructureRow.cs
@@ -54,8 +54,8 @@ internal class StructureRow : INotifyPropertyChanged
///
public string ButtonIcon =>
HasButton && !((StructureFieldComplex)Field).Collapsed
- ? IconChar.PlusSquare.ToChar()
- : IconChar.MinusSquare.ToChar();
+ ? IconChar.MinusSquare.ToChar()
+ : IconChar.PlusSquare.ToChar();
///
/// Глубина отображения поля.
diff --git a/Pf2eDataScrapper/WPF/EntityViewer/ViewModel/EntityListViewModel.cs b/Pf2eDataScrapper/WPF/EntityViewer/ViewModel/EntityListViewModel.cs
index 8a42d3f..1598578 100644
--- a/Pf2eDataScrapper/WPF/EntityViewer/ViewModel/EntityListViewModel.cs
+++ b/Pf2eDataScrapper/WPF/EntityViewer/ViewModel/EntityListViewModel.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
-using AngleSharp.Browser;
using LinqToDB.DataProvider.Access;
using Pf2eDataScrapper.WPF.EntityViewer.Stores;
using Pf2eModel;
@@ -129,13 +128,41 @@ internal class EntityListViewModel : ViewModelBase
#region "Методы кнопок"
- public void FirstPage() => Page = 1;
+ private PageNavigationCommand? _firstPageCommand;
+ public PageNavigationCommand FirstPageCommand
+ {
+ get
+ {
+ return _firstPageCommand ??= new PageNavigationCommand(() => { Page = 1; });
+ }
+ }
- public void PreviousPage() => Page--;
+ private PageNavigationCommand? _previousPageCommand;
+ public PageNavigationCommand PreviousPageCommand
+ {
+ get
+ {
+ return _previousPageCommand ??= new PageNavigationCommand(() => { Page--; });
+ }
+ }
- public void NextPage() => Page++;
+ private PageNavigationCommand? _nextPageCommand;
+ public PageNavigationCommand NextPageCommand
+ {
+ get
+ {
+ return _nextPageCommand ??= new PageNavigationCommand(() => { Page++; });
+ }
+ }
- public void LastPage() => Page = PageCount;
+ private PageNavigationCommand? _lastPageCommand;
+ public PageNavigationCommand LastPageCommand
+ {
+ get
+ {
+ return _lastPageCommand ??= new PageNavigationCommand(() => { Page = PageCount; });
+ }
+ }
public bool HasPrevious => Page != 1;
@@ -167,3 +194,20 @@ internal class EntityListViewModel : ViewModelBase
#endregion
}
+
+public class PageNavigationCommand(Action action) : System.Windows.Input.ICommand
+{
+ public Action Action { get; } = action;
+
+ public event EventHandler? CanExecuteChanged;
+
+ public bool CanExecute(object? parameter)
+ {
+ return true;
+ }
+
+ public void Execute(object? parameter)
+ {
+ Action.Invoke();
+ }
+}