NewFileDialog.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using PixiEditor.Models.UserPreferences;
  2. using PixiEditor.Views;
  3. namespace PixiEditor.Models.Dialogs
  4. {
  5. public class NewFileDialog : CustomDialog
  6. {
  7. public const int defaultSize = 64;
  8. private int height = IPreferences.Current.GetPreference("DefaultNewFileHeight", defaultSize);
  9. private int width = IPreferences.Current.GetPreference("DefaultNewFileWidth", defaultSize);
  10. public int Width
  11. {
  12. get => width;
  13. set => SetProperty(ref width, value);
  14. }
  15. public int Height
  16. {
  17. get => height;
  18. set => SetProperty(ref height, value);
  19. }
  20. public override bool ShowDialog()
  21. {
  22. NewFilePopup popup = new()
  23. {
  24. FileWidth = Width,
  25. FileHeight = Height
  26. };
  27. popup.ShowDialog();
  28. Height = popup.FileHeight;
  29. Width = popup.FileWidth;
  30. return popup.DialogResult.GetValueOrDefault();
  31. }
  32. }
  33. }