TextEditViewModel.cs 583 B

123456789101112131415161718192021222324252627282930
  1. using CommunityToolkit.Mvvm.ComponentModel;
  2. using CommunityToolkit.Mvvm.Input;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace InABox.Avalonia.Components;
  9. public partial class TextEditViewModel : BasePopupViewModel<string>
  10. {
  11. [ObservableProperty]
  12. private string _text = "";
  13. [ObservableProperty]
  14. private bool _multiline = false;
  15. [RelayCommand]
  16. private void Cancel()
  17. {
  18. Close(null);
  19. }
  20. [RelayCommand]
  21. private void OK()
  22. {
  23. Close(Text);
  24. }
  25. }