FeedbackDialogViewModel.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using PixiEditor.Helpers;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Net.Mail;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. namespace PixiEditor.ViewModels
  10. {
  11. class FeedbackDialogViewModel : ViewModelBase
  12. {
  13. public RelayCommand CloseButtonCommand { get; set; }
  14. public RelayCommand SendButtonCommand { get; set; }
  15. private string _mailFrom;
  16. public string MailFrom
  17. {
  18. get { return _mailFrom; }
  19. set { if (_mailFrom != value) { _mailFrom = value; RaisePropertyChanged("MailFrom"); } }
  20. }
  21. private string _emailBody;
  22. public string EmailBody
  23. {
  24. get { return _emailBody; }
  25. set { if (_emailBody != value) { _emailBody = value; RaisePropertyChanged("EmailBody"); } }
  26. }
  27. public FeedbackDialogViewModel()
  28. {
  29. CloseButtonCommand = new RelayCommand(CloseWindow);
  30. SendButtonCommand = new RelayCommand(Send, CanSend);
  31. }
  32. private void CloseWindow(object parameter)
  33. {
  34. ((Window)parameter).DialogResult = false;
  35. base.CloseButton(parameter);
  36. }
  37. private void Send(object parameter)
  38. {
  39. base.CloseButton(parameter);
  40. }
  41. private bool CanSend(object property)
  42. {
  43. return !string.IsNullOrWhiteSpace(MailFrom);
  44. }
  45. }
  46. }