GeneralRecipeVM.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. namespace RecipeModule.ViewModels;
  2. public partial class GeneralRecipeVM(IDialogService dialogService) : ObservableObject, IActiveAware
  3. {
  4. protected IDialogService dialogService = dialogService;
  5. event EventHandler IActiveAware.IsActiveChanged { add { } remove { } }
  6. private bool _IsActive;
  7. public bool IsActive
  8. {
  9. get { return _IsActive; }
  10. set
  11. {
  12. _IsActive = value;
  13. if (value)
  14. this.OnActive();
  15. }
  16. }
  17. protected virtual void OnActive()
  18. {
  19. }
  20. [ObservableProperty]
  21. private ObservableCollection<RecipeDirectory>? _Directories;
  22. [ObservableProperty]
  23. private RecipeDirectory? _SelectedRecipeDirectory;
  24. [ObservableProperty]
  25. private ObservableCollection<RecipeInfo>? _Recipes;
  26. [ObservableProperty]
  27. private RecipeInfo? _SelectedRecipeInfo;
  28. [ObservableProperty]
  29. private string? _Title;
  30. [RelayCommand]
  31. private void DirOperate()
  32. {
  33. }
  34. [RelayCommand]
  35. private void RecipeOperate(RecipeOpreateEnum recipeOpreateEnum)
  36. {
  37. Commands(recipeOpreateEnum);
  38. }
  39. protected virtual void Commands(RecipeOpreateEnum recipeOpreateEnum)
  40. {
  41. switch (recipeOpreateEnum)
  42. {
  43. case RecipeOpreateEnum.New:
  44. break;
  45. case RecipeOpreateEnum.Delete:
  46. break;
  47. case RecipeOpreateEnum.Edit:
  48. dialogService.Show("RecipeEdit");
  49. break;
  50. case RecipeOpreateEnum.Rename:
  51. break;
  52. case RecipeOpreateEnum.Copy:
  53. break;
  54. case RecipeOpreateEnum.View:
  55. break;
  56. case RecipeOpreateEnum.Export:
  57. break;
  58. case RecipeOpreateEnum.Change:
  59. break;
  60. case RecipeOpreateEnum.History:
  61. break;
  62. default:
  63. break;
  64. }
  65. }
  66. }
  67. public enum RecipeOpreateEnum
  68. {
  69. New,
  70. Delete,
  71. Edit,
  72. Rename,
  73. Copy,
  74. View,
  75. Export,
  76. Change,
  77. History
  78. }