1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Windows;
- using PixiEditor.Models.UserPreferences;
- using PixiEditor.Views;
- namespace PixiEditor.Models.Dialogs
- {
- public class NewFileDialog : CustomDialog
- {
- private int height = (int)PreferencesSettings.GetPreference("DefaultNewFileHeight", 16L);
- private int width = (int)PreferencesSettings.GetPreference("DefaultNewFileWidth", 16L);
- public int Width
- {
- get => width;
- set
- {
- if (width != value)
- {
- width = value;
- RaisePropertyChanged("Width");
- }
- }
- }
- public int Height
- {
- get => height;
- set
- {
- if (height != value)
- {
- height = value;
- RaisePropertyChanged("Height");
- }
- }
- }
- public override bool ShowDialog()
- {
- Window popup = new NewFilePopup()
- {
- FileWidth = Width,
- FileHeight = Height
- };
- popup.ShowDialog();
- Height = (popup as NewFilePopup).FileHeight;
- Width = (popup as NewFilePopup).FileWidth;
- return (bool)popup.DialogResult;
- }
- }
- }
|