NewFileDialog.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Windows;
  3. using PixiEditor.Models.UserPreferences;
  4. using PixiEditor.Views;
  5. namespace PixiEditor.Models.Dialogs
  6. {
  7. public class NewFileDialog : CustomDialog
  8. {
  9. private int height = (int)PreferencesSettings.GetPreference("DefaultNewFileHeight", 16L);
  10. private int width = (int)PreferencesSettings.GetPreference("DefaultNewFileWidth", 16L);
  11. public int Width
  12. {
  13. get => width;
  14. set
  15. {
  16. if (width != value)
  17. {
  18. width = value;
  19. RaisePropertyChanged("Width");
  20. }
  21. }
  22. }
  23. public int Height
  24. {
  25. get => height;
  26. set
  27. {
  28. if (height != value)
  29. {
  30. height = value;
  31. RaisePropertyChanged("Height");
  32. }
  33. }
  34. }
  35. public override bool ShowDialog()
  36. {
  37. Window popup = new NewFilePopup()
  38. {
  39. FileWidth = Width,
  40. FileHeight = Height
  41. };
  42. popup.ShowDialog();
  43. Height = (popup as NewFilePopup).FileHeight;
  44. Width = (popup as NewFilePopup).FileWidth;
  45. return (bool)popup.DialogResult;
  46. }
  47. }
  48. }