WpfPreviewControl.Commands.cs 717 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Windows.Input;
  3. namespace FastReport.Preview
  4. {
  5. public partial class WpfPreviewControl
  6. {
  7. /// <summary>
  8. /// Represents a preview command.
  9. /// </summary>
  10. public class PreviewCommand : ICommand
  11. {
  12. private Action action;
  13. /// <inheritdoc/>
  14. public event EventHandler CanExecuteChanged;
  15. /// <inheritdoc/>
  16. public bool CanExecute(object parameter) => true;
  17. /// <inheritdoc/>
  18. public void Execute(object parameter) => action();
  19. internal PreviewCommand(Action action)
  20. {
  21. this.action = action;
  22. }
  23. }
  24. }
  25. }