ExportFileDialog.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using PixiEditor.Views;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. namespace PixiEditor.Models
  10. {
  11. public class ExportFileDialog : CustomDialog
  12. {
  13. private int _fileWidth;
  14. public int FileWidth
  15. {
  16. get { return _fileWidth; }
  17. set { if (_fileWidth != value) { _fileWidth = value; RaisePropertyChanged("Width"); } }
  18. }
  19. private int _fileHeight;
  20. public int FileHeight
  21. {
  22. get { return _fileHeight; }
  23. set { if (_fileHeight != value) { _fileHeight = value; RaisePropertyChanged("FileHeight"); } }
  24. }
  25. private string _filePath;
  26. public string FilePath
  27. {
  28. get { return _filePath; }
  29. set { if (_filePath != value) { _filePath = value; RaisePropertyChanged("FilePath"); } }
  30. }
  31. public ExportFileDialog(Size fileDimensions)
  32. {
  33. FileHeight = (int)fileDimensions.Height;
  34. FileWidth = (int)fileDimensions.Width;
  35. }
  36. public override bool ShowDialog()
  37. {
  38. SaveFilePopup popup = new SaveFilePopup
  39. {
  40. SaveWidth = FileWidth,
  41. SaveHeight = FileHeight
  42. };
  43. popup.ShowDialog();
  44. if (popup.DialogResult == true)
  45. {
  46. FileWidth = popup.SaveWidth;
  47. FileHeight = popup.SaveHeight;
  48. FilePath = popup.SavePath;
  49. }
  50. return (bool)popup.DialogResult;
  51. }
  52. }
  53. }