BottomPopManager.cs 689 B

123456789101112131415161718192021222324252627
  1. using System.Windows.Controls;
  2. using System.Windows.Media;
  3. namespace DataVM;
  4. public interface IBottomPopManager
  5. {
  6. bool RegistBottomPop<TView, TViewModel>(string key) where TView : UserControl, new() where TViewModel : IPopAware, new();
  7. bool ShowPop(string key, object? state = null);
  8. }
  9. public interface IPopAware
  10. {
  11. ImageSource? ImageSource { get; set; }
  12. string? Title { get; set; }
  13. Action? RequestClose { get; set; }
  14. void OnPop(object? state);
  15. bool CanClose();
  16. void OnClose();
  17. }
  18. public class BottomPopContent(UserControl view, IPopAware viewModel)
  19. {
  20. public UserControl View { get; } = view;
  21. public IPopAware ViewModel { get; } = viewModel;
  22. }