Переглянути джерело

Structured Views and added SubViewModel, UpdateSVM and IoSVM

flabbet 4 роки тому
батько
коміт
acc9686d65
38 змінених файлів з 451 додано та 369 видалено
  1. 171 0
      PixiEditor/ViewModels/SubViewModels/Main/IoViewModel.cs
  2. 99 0
      PixiEditor/ViewModels/SubViewModels/Main/UpdateViewModel.cs
  3. 12 0
      PixiEditor/ViewModels/SubViewModels/SubViewModel.cs
  4. 30 231
      PixiEditor/ViewModels/ViewModelMain.cs
  5. 0 0
      PixiEditor/Views/Dialogs/ConfirmationPopup.xaml
  6. 0 0
      PixiEditor/Views/Dialogs/ConfirmationPopup.xaml.cs
  7. 0 0
      PixiEditor/Views/Dialogs/ImportFilePopup.xaml
  8. 0 0
      PixiEditor/Views/Dialogs/ImportFilePopup.xaml.cs
  9. 0 0
      PixiEditor/Views/Dialogs/NewFilePopup.xaml
  10. 0 0
      PixiEditor/Views/Dialogs/NewFilePopup.xaml.cs
  11. 0 0
      PixiEditor/Views/Dialogs/PopupTemplate.xaml
  12. 0 0
      PixiEditor/Views/Dialogs/PopupTemplate.xaml.cs
  13. 0 0
      PixiEditor/Views/Dialogs/ResizeCanvasPopup.xaml
  14. 0 0
      PixiEditor/Views/Dialogs/ResizeCanvasPopup.xaml.cs
  15. 0 0
      PixiEditor/Views/Dialogs/ResizeDocumentPopup.xaml
  16. 0 0
      PixiEditor/Views/Dialogs/ResizeDocumentPopup.xaml.cs
  17. 0 0
      PixiEditor/Views/Dialogs/SaveFilePopup.xaml
  18. 0 0
      PixiEditor/Views/Dialogs/SaveFilePopup.xaml.cs
  19. 13 12
      PixiEditor/Views/MainWindow.xaml
  20. 0 0
      PixiEditor/Views/UserControls/AnchorPointPicker.xaml
  21. 0 0
      PixiEditor/Views/UserControls/AnchorPointPicker.xaml.cs
  22. 24 24
      PixiEditor/Views/UserControls/EditableTextBlock.xaml
  23. 100 100
      PixiEditor/Views/UserControls/EditableTextBlock.xaml.cs
  24. 0 0
      PixiEditor/Views/UserControls/LayerItem.xaml
  25. 0 0
      PixiEditor/Views/UserControls/LayerItem.xaml.cs
  26. 0 0
      PixiEditor/Views/UserControls/MainDrawingPanel.xaml
  27. 0 0
      PixiEditor/Views/UserControls/MainDrawingPanel.xaml.cs
  28. 0 0
      PixiEditor/Views/UserControls/MenuButton.xaml
  29. 0 0
      PixiEditor/Views/UserControls/MenuButton.xaml.cs
  30. 0 0
      PixiEditor/Views/UserControls/NumberInput.xaml
  31. 0 0
      PixiEditor/Views/UserControls/NumberInput.xaml.cs
  32. 0 0
      PixiEditor/Views/UserControls/Rotatebox.xaml
  33. 0 0
      PixiEditor/Views/UserControls/Rotatebox.xaml.cs
  34. 0 0
      PixiEditor/Views/UserControls/SizeInput.xaml
  35. 0 0
      PixiEditor/Views/UserControls/SizeInput.xaml.cs
  36. 0 0
      PixiEditor/Views/UserControls/SizePicker.xaml
  37. 0 0
      PixiEditor/Views/UserControls/SizePicker.xaml.cs
  38. 2 2
      PixiEditorTests/ViewModelsTests/ViewModelMainTests.cs

+ 171 - 0
PixiEditor/ViewModels/SubViewModels/Main/IoViewModel.cs

@@ -0,0 +1,171 @@
+using Microsoft.Win32;
+using PixiEditor.Helpers;
+using PixiEditor.Models.DataHolders;
+using PixiEditor.Models.Dialogs;
+using PixiEditor.Models.Enums;
+using PixiEditor.Models.IO;
+using System;
+using System.IO;
+using System.Linq;
+using System.Windows;
+using System.Windows.Media.Imaging;
+
+namespace PixiEditor.ViewModels.SubViewModels.Main
+{
+    public class IoViewModel : SubViewModel<ViewModelMain>
+    {
+        public RelayCommand OpenNewFilePopupCommand { get; set; }
+        public RelayCommand SaveDocumentCommand { get; set; }
+        public RelayCommand OpenFileCommand { get; set; }
+        public RelayCommand ExportFileCommand { get; set; } //Command that is used to save file
+
+        public IoViewModel(ViewModelMain owner) : base(owner)
+        {
+            OpenNewFilePopupCommand = new RelayCommand(OpenNewFilePopup);
+            SaveDocumentCommand = new RelayCommand(SaveDocument, Owner.DocumentIsNotNull);
+            OpenFileCommand = new RelayCommand(Open);
+            ExportFileCommand = new RelayCommand(ExportFile, CanSave);
+            Owner.OnStartupEvent += Owner_OnStartupEvent;
+        }
+
+        private void Owner_OnStartupEvent(object sender, System.EventArgs e)
+        {
+            var lastArg = Environment.GetCommandLineArgs().Last();
+            if (Importer.IsSupportedFile(lastArg) && File.Exists(lastArg))
+            {
+                Open(lastArg);
+            }
+            else
+            {
+                OpenNewFilePopup(null);
+            }
+        }
+
+        /// <summary>
+        ///     Generates new Layer and sets it as active one
+        /// </summary>
+        /// <param name="parameter"></param>
+        public void OpenNewFilePopup(object parameter)
+        {
+            NewFileDialog newFile = new NewFileDialog();
+            if (newFile.ShowDialog())
+            {
+                NewDocument(newFile.Width, newFile.Height);
+            }
+        }
+
+        public void NewDocument(int width, int height, bool addBaseLayer = true)
+        {
+            Owner.BitmapManager.ActiveDocument = new Document(width, height);
+            if (addBaseLayer)
+            {
+                Owner.BitmapManager.AddNewLayer("Base Layer");
+            }
+            Owner.ResetProgramStateValues();
+        }
+
+
+        /// <summary>
+        ///     Opens file from path.
+        /// </summary>
+        /// <param name="path"></param>
+        public void OpenFile(string path)
+        {
+            ImportFileDialog dialog = new ImportFileDialog();
+
+            if (path != null && File.Exists(path))
+                dialog.FilePath = path;
+
+            if (dialog.ShowDialog())
+            {
+                NewDocument(dialog.FileWidth, dialog.FileHeight, false);
+                Owner.BitmapManager.AddNewLayer("Image", Importer.ImportImage(dialog.FilePath, dialog.FileWidth, dialog.FileHeight));
+            }
+        }
+
+        private void Open(string path)
+        {
+            if (Owner.UnsavedDocumentModified)
+            {
+                var result = ConfirmationDialog.Show(ViewModelMain.ConfirmationDialogMessage);
+                if (result == ConfirmationType.Yes)
+                {
+                    SaveDocument(null);
+                }
+                else if (result == ConfirmationType.Canceled)
+                {
+                    return;
+                }
+            }
+
+            Owner.ResetProgramStateValues();
+            if (path.EndsWith(".pixi"))
+                OpenDocument(path);
+            else
+                OpenFile(path);
+        }
+
+        private void Open(object property)
+        {
+            OpenFileDialog dialog = new OpenFileDialog
+            {
+                Filter = "All Files|*.*|PixiEditor Files | *.pixi|PNG Files|*.png",
+                DefaultExt = "pixi"
+            };
+            if ((bool)dialog.ShowDialog())
+            {
+                if (Importer.IsSupportedFile(dialog.FileName))
+                    Open(dialog.FileName);
+                Owner.RecenterZoombox = !Owner.RecenterZoombox;
+            }
+        }
+
+        private void OpenDocument(string path)
+        {
+            Owner.BitmapManager.ActiveDocument = Importer.ImportDocument(path);
+            Exporter.SaveDocumentPath = path;
+            Owner.UnsavedDocumentModified = false;
+        }
+
+        public void SaveDocument(bool asNew)
+        {
+            SaveDocument(parameter: asNew ? "asnew" : null);
+        }
+
+        private void SaveDocument(object parameter)
+        {
+            bool paramIsAsNew = parameter != null && parameter.ToString()?.ToLower() == "asnew";
+            if (paramIsAsNew || Exporter.SaveDocumentPath == null)
+            {
+                var saved = Exporter.SaveAsEditableFileWithDialog(Owner.BitmapManager.ActiveDocument, !paramIsAsNew);
+                Owner.UnsavedDocumentModified = Owner.UnsavedDocumentModified && !saved;
+            }
+            else
+            {
+                Exporter.SaveAsEditableFile(Owner.BitmapManager.ActiveDocument, Exporter.SaveDocumentPath);
+                Owner.UnsavedDocumentModified = false;
+            }
+        }
+
+        /// <summary>
+        ///     Generates export dialog or saves directly if save data is known.
+        /// </summary>
+        /// <param name="parameter"></param>
+        private void ExportFile(object parameter)
+        {
+            WriteableBitmap bitmap = Owner.BitmapManager.GetCombinedLayersBitmap();
+            Exporter.Export(bitmap, new Size(bitmap.PixelWidth, bitmap.PixelHeight));
+        }
+
+        /// <summary>
+        ///     Returns true if file save is possible.
+        /// </summary>
+        /// <param name="property"></param>
+        /// <returns></returns>
+        private bool CanSave(object property)
+        {
+            return Owner.BitmapManager.ActiveDocument != null;
+        }
+
+    }
+}

+ 99 - 0
PixiEditor/ViewModels/SubViewModels/Main/UpdateViewModel.cs

@@ -0,0 +1,99 @@
+using PixiEditor.Helpers;
+using PixiEditor.Models.Processes;
+using PixiEditor.UpdateModule;
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PixiEditor.ViewModels.SubViewModels.Main
+{
+    public class UpdateViewModel : SubViewModel<ViewModelMain>
+    {
+
+        private bool _updateReadyToInstall = false;
+
+        public UpdateChecker UpdateChecker { get; set; }
+
+        public RelayCommand RestartApplicationCommand { get; set; }
+
+        private string _versionText;
+
+        public string VersionText
+        {
+            get => _versionText;
+            set
+            {
+                _versionText = value;
+                RaisePropertyChanged(nameof(VersionText));
+            }
+        }
+
+
+        public bool UpdateReadyToInstall
+        {
+            get => _updateReadyToInstall;
+            set
+            {
+                _updateReadyToInstall = value;
+                RaisePropertyChanged(nameof(UpdateReadyToInstall));
+            }
+        }
+
+        public UpdateViewModel(ViewModelMain owner) : base(owner)
+        {
+            Owner.OnStartupEvent += Owner_OnStartupEvent;
+            RestartApplicationCommand = new RelayCommand(RestartApplication);
+            InitUpdateChecker();
+        }
+
+        private async void Owner_OnStartupEvent(object sender, EventArgs e)
+        {
+            await CheckForUpdate();
+        }
+
+        private void RestartApplication(object parameter)
+        {
+            try
+            {
+                ProcessHelper.RunAsAdmin(Path.Join(AppDomain.CurrentDomain.BaseDirectory, "PixiEditor.UpdateInstaller.exe"));
+                Application.Current.Shutdown();
+            }
+            catch (Win32Exception)
+            {
+                MessageBox.Show("Couldn't update without administrator rights.", "Insufficient permissions",
+                    MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        public async Task<bool> CheckForUpdate()
+        {
+            return await Task.Run(async () =>
+            {
+                bool updateAvailable = await UpdateChecker.CheckUpdateAvailable();
+                bool updateFileDoesNotExists = !File.Exists(
+                    Path.Join(UpdateDownloader.DownloadLocation, $"update-{UpdateChecker.LatestReleaseInfo.TagName}.zip"));
+                if (updateAvailable && updateFileDoesNotExists)
+                {
+                    VersionText = "Downloading update...";
+                    await UpdateDownloader.DownloadReleaseZip(UpdateChecker.LatestReleaseInfo);
+                    VersionText = "to install update"; //Button shows "Restart" before this text
+                    UpdateReadyToInstall = true;
+                    return true;
+                }
+                return false;
+            });
+        }
+
+        private void InitUpdateChecker()
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            FileVersionInfo info = FileVersionInfo.GetVersionInfo(assembly.Location);
+            UpdateChecker = new UpdateChecker(info.FileVersion);
+            VersionText = $"Version {info.FileVersion}";
+        }
+    }
+}

+ 12 - 0
PixiEditor/ViewModels/SubViewModels/SubViewModel.cs

@@ -0,0 +1,12 @@
+namespace PixiEditor.ViewModels.SubViewModels
+{
+    public class SubViewModel<T> : ViewModelBase where T: ViewModelBase
+    {
+        public T Owner { get; }
+
+        public SubViewModel(T owner)
+        {
+            Owner = owner;
+        }        
+    }
+}

+ 30 - 231
PixiEditor/ViewModels/ViewModelMain.cs

@@ -3,15 +3,10 @@ using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.Diagnostics;
-using System.IO;
 using System.Linq;
-using System.Reflection;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Input;
 using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using Microsoft.Win32;
 using PixiEditor.Helpers;
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.Controllers.Shortcuts;
@@ -21,16 +16,17 @@ using PixiEditor.Models.Enums;
 using PixiEditor.Models.Events;
 using PixiEditor.Models.IO;
 using PixiEditor.Models.Position;
-using PixiEditor.Models.Processes;
 using PixiEditor.Models.Tools;
 using PixiEditor.Models.Tools.Tools;
-using PixiEditor.UpdateModule;
+using PixiEditor.ViewModels.SubViewModels.Main;
 
 namespace PixiEditor.ViewModels
 {
     public class ViewModelMain : ViewModelBase
     {
-        private const string ConfirmationDialogMessage = "Document was modified. Do you want to save changes?";
+        public const string ConfirmationDialogMessage = "Document was modified. Do you want to save changes?";
+
+        public event EventHandler OnStartupEvent;
 
         private Color _primaryColor = Colors.Black;
 
@@ -44,21 +40,18 @@ namespace PixiEditor.ViewModels
 
         private LayerChange[] _undoChanges;
 
-        private bool _unsavedDocumentModified;
+        public bool UnsavedDocumentModified { get; set; }
 
         public Action CloseAction { get; set; }
 
         public static ViewModelMain Current { get; set; }
         public RelayCommand SelectToolCommand { get; set; } //Command that handles tool switching 
-        public RelayCommand OpenNewFilePopupCommand { get; set; } //Command that generates draw area
-        public RelayCommand MouseMoveCommand { get; set; } //Command that is used to draw
+        public RelayCommand MouseMoveCommand { get; set; }
         public RelayCommand MouseDownCommand { get; set; }
         public RelayCommand KeyDownCommand { get; set; }
         public RelayCommand KeyUpCommand { get; set; }
-        public RelayCommand ExportFileCommand { get; set; } //Command that is used to save file
         public RelayCommand UndoCommand { get; set; }
         public RelayCommand RedoCommand { get; set; }
-        public RelayCommand OpenFileCommand { get; set; }
         public RelayCommand SetActiveLayerCommand { get; set; }
         public RelayCommand NewLayerCommand { get; set; }
         public RelayCommand DeleteLayerCommand { get; set; }
@@ -77,14 +70,15 @@ namespace PixiEditor.ViewModels
         public RelayCommand OpenResizePopupCommand { get; set; }
         public RelayCommand SelectColorCommand { get; set; }
         public RelayCommand RemoveSwatchCommand { get; set; }
-        public RelayCommand SaveDocumentCommand { get; set; }
         public RelayCommand OnStartupCommand { get; set; }
         public RelayCommand CloseWindowCommand { get; set; }
         public RelayCommand CenterContentCommand { get; set; }
         public RelayCommand OpenHyperlinkCommand { get; set; }
         public RelayCommand ZoomCommand { get; set; }
         public RelayCommand ChangeToolSizeCommand { get; set; }
-        public RelayCommand RestartApplicationCommand { get; set; }
+        
+        public IoViewModel IoSubViewModel { get; set; }
+        public UpdateViewModel UpdateSubViewModel { get; set; }
 
 
         private double _mouseXonCanvas;
@@ -111,19 +105,6 @@ namespace PixiEditor.ViewModels
             }
         }
 
-        private string _versionText;
-
-        public string VersionText
-        {
-            get => _versionText;
-            set
-            {
-                _versionText = value;
-                RaisePropertyChanged(nameof(VersionText));
-            }
-        }
-
-
         public bool RecenterZoombox
         {
             get => _recenterZoombox;
@@ -208,19 +189,6 @@ namespace PixiEditor.ViewModels
             }
         }
 
-
-        private bool _updateReadyToInstall = false;
-
-        public bool UpdateReadyToInstall
-        {
-            get => _updateReadyToInstall;
-            set
-            {
-                _updateReadyToInstall = value;
-                RaisePropertyChanged(nameof(UpdateReadyToInstall));
-            }
-        }
-
         public BitmapManager BitmapManager { get; set; }
         public PixelChangesController ChangesController { get; set; }
 
@@ -239,8 +207,6 @@ namespace PixiEditor.ViewModels
         private bool _restoreToolOnKeyUp = false;
         public Tool LastActionTool { get; private set; }
 
-        public UpdateChecker UpdateChecker { get; set; }
-
         public ViewModelMain()
         {
             BitmapManager = new BitmapManager();
@@ -249,13 +215,10 @@ namespace PixiEditor.ViewModels
             BitmapManager.DocumentChanged += BitmapManager_DocumentChanged;
             ChangesController = new PixelChangesController();
             SelectToolCommand = new RelayCommand(SetTool, DocumentIsNotNull);
-            OpenNewFilePopupCommand = new RelayCommand(OpenNewFilePopup);
             MouseMoveCommand = new RelayCommand(MouseMove);
             MouseDownCommand = new RelayCommand(MouseDown);
-            ExportFileCommand = new RelayCommand(ExportFile, CanSave);
             UndoCommand = new RelayCommand(Undo, CanUndo);
             RedoCommand = new RelayCommand(Redo, CanRedo);
-            OpenFileCommand = new RelayCommand(Open);
             SetActiveLayerCommand = new RelayCommand(SetActiveLayer);
             NewLayerCommand = new RelayCommand(NewLayer, CanCreateNewLayer);
             DeleteLayerCommand = new RelayCommand(DeleteLayer, CanDeleteLayer);
@@ -276,14 +239,16 @@ namespace PixiEditor.ViewModels
             OpenResizePopupCommand = new RelayCommand(OpenResizePopup, DocumentIsNotNull);
             SelectColorCommand = new RelayCommand(SelectColor);
             RemoveSwatchCommand = new RelayCommand(RemoveSwatch);
-            SaveDocumentCommand = new RelayCommand(SaveDocument, DocumentIsNotNull);
             OnStartupCommand = new RelayCommand(OnStartup);
             CloseWindowCommand = new RelayCommand(CloseWindow);
             CenterContentCommand = new RelayCommand(CenterContent, DocumentIsNotNull);
             OpenHyperlinkCommand = new RelayCommand(OpenHyperlink);
             ZoomCommand = new RelayCommand(ZoomViewport);
             ChangeToolSizeCommand = new RelayCommand(ChangeToolSize);
-            RestartApplicationCommand = new RelayCommand(RestartApplication);
+
+            IoSubViewModel = new IoViewModel(this);
+            UpdateSubViewModel = new UpdateViewModel(this);
+
             ToolSet = new ObservableCollection<Tool>
             {
                 new MoveViewportTool(), new MoveTool(), new PenTool(), new SelectTool(), new FloodFill(), new LineTool(),
@@ -326,12 +291,12 @@ namespace PixiEditor.ViewModels
                     new Shortcut(Key.C, OpenResizePopupCommand, "canvas", ModifierKeys.Control | ModifierKeys.Shift),
                     new Shortcut(Key.F11, SystemCommands.MaximizeWindowCommand),
                     //File
-                    new Shortcut(Key.O, OpenFileCommand, modifier: ModifierKeys.Control),
-                    new Shortcut(Key.S, ExportFileCommand,
+                    new Shortcut(Key.O, IoSubViewModel.OpenFileCommand, modifier: ModifierKeys.Control),
+                    new Shortcut(Key.S, IoSubViewModel.ExportFileCommand,
                         modifier: ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt),
-                    new Shortcut(Key.S, SaveDocumentCommand, modifier: ModifierKeys.Control),
-                    new Shortcut(Key.S, SaveDocumentCommand, "AsNew", ModifierKeys.Control | ModifierKeys.Shift),
-                    new Shortcut(Key.N, OpenNewFilePopupCommand, modifier: ModifierKeys.Control),
+                    new Shortcut(Key.S, IoSubViewModel.SaveDocumentCommand, modifier: ModifierKeys.Control),
+                    new Shortcut(Key.S, IoSubViewModel.SaveDocumentCommand, "AsNew", ModifierKeys.Control | ModifierKeys.Shift),
+                    new Shortcut(Key.N, IoSubViewModel.OpenNewFilePopupCommand, modifier: ModifierKeys.Control),
                 }
             };
             UndoManager.SetMainRoot(this);
@@ -339,49 +304,7 @@ namespace PixiEditor.ViewModels
             BitmapManager.PrimaryColor = PrimaryColor;
             ActiveSelection = new Selection(Array.Empty<Coordinates>());
             Current = this;
-            InitUpdateChecker();
-        }
-
-        private void RestartApplication(object parameter)
-        {
-            try
-            {
-                ProcessHelper.RunAsAdmin(Path.Join(AppDomain.CurrentDomain.BaseDirectory, "PixiEditor.UpdateInstaller.exe"));
-                Application.Current.Shutdown();
-            }
-            catch (Win32Exception)
-            {
-                MessageBox.Show("Couldn't update without administrator rights.", "Insufficient permissions",
-                    MessageBoxButton.OK, MessageBoxImage.Error);
-            }
-        }
-
-        public async Task<bool> CheckForUpdate()
-        {
-            return await Task.Run(async () =>
-            {
-                bool updateAvailable = await UpdateChecker.CheckUpdateAvailable();
-                bool updateFileDoesNotExists = !File.Exists(
-                    Path.Join(UpdateDownloader.DownloadLocation, $"update-{UpdateChecker.LatestReleaseInfo.TagName}.zip"));
-                if (updateAvailable && updateFileDoesNotExists)
-                {
-                    VersionText = "Downloading update...";
-                    await UpdateDownloader.DownloadReleaseZip(UpdateChecker.LatestReleaseInfo);
-                    VersionText = "to install update"; //Button shows "Restart" before this text
-                    UpdateReadyToInstall = true;
-                    return true;
-                }
-                return false;
-            });
-        }
-
-        private void InitUpdateChecker()
-        {
-            var assembly = Assembly.GetExecutingAssembly();
-            FileVersionInfo info = FileVersionInfo.GetVersionInfo(assembly.Location);
-            UpdateChecker = new UpdateChecker(info.FileVersion);
-            VersionText = $"Version {info.FileVersion}";
-        }
+        }        
 
         private void ZoomViewport(object parameter)
         {
@@ -424,92 +347,28 @@ namespace PixiEditor.ViewModels
             ((CancelEventArgs) property).Cancel = true;
 
             ConfirmationType result = ConfirmationType.No;
-            if (_unsavedDocumentModified)
+            if (UnsavedDocumentModified)
             {
                 result = ConfirmationDialog.Show(ConfirmationDialogMessage);
-                if (result == ConfirmationType.Yes) SaveDocument(null);
+                if (result == ConfirmationType.Yes) 
+                {
+                    IoSubViewModel.SaveDocument(false); 
+                }
             }
 
             if (result != ConfirmationType.Canceled) ((CancelEventArgs) property).Cancel = false;
         }
 
-        private async void OnStartup(object parameter)
+        private void OnStartup(object parameter)
         {
-            var lastArg = Environment.GetCommandLineArgs().Last();
-            if (Importer.IsSupportedFile(lastArg) && File.Exists(lastArg))
-            {
-                Open(lastArg);
-            }
-            else
-            {
-                OpenNewFilePopup(null);
-            }
-            await CheckForUpdate();
+            OnStartupEvent?.Invoke(this, EventArgs.Empty);
         }
 
         private void BitmapManager_DocumentChanged(object sender, DocumentChangedEventArgs e)
         {
             e.NewDocument.DocumentSizeChanged += ActiveDocument_DocumentSizeChanged;
         }
-
-        private void Open(object property)
-        {
-            OpenFileDialog dialog = new OpenFileDialog
-            {
-                Filter = "All Files|*.*|PixiEditor Files | *.pixi|PNG Files|*.png",
-                DefaultExt = "pixi"
-            };
-            if ((bool) dialog.ShowDialog())
-            {
-                if (Importer.IsSupportedFile(dialog.FileName))
-                    Open(dialog.FileName);
-                RecenterZoombox = !RecenterZoombox;
-            }
-        }
-
-        private void Open(string path)
-        {
-            if (_unsavedDocumentModified)
-            {
-                var result = ConfirmationDialog.Show(ConfirmationDialogMessage);
-                if (result == ConfirmationType.Yes)
-                {
-                    SaveDocument(null);
-                }
-                else if (result == ConfirmationType.Canceled)
-                {
-                    return;
-                }
-            }
-
-            ResetProgramStateValues();
-            if (path.EndsWith(".pixi"))
-                OpenDocument(path);
-            else
-                OpenFile(path);
-        }
-
-        private void OpenDocument(string path)
-        {
-            BitmapManager.ActiveDocument = Importer.ImportDocument(path);
-            Exporter.SaveDocumentPath = path;
-            _unsavedDocumentModified = false;
-        }
-
-        private void SaveDocument(object parameter)
-        {
-            bool paramIsAsNew = parameter != null && parameter.ToString()?.ToLower() == "asnew";
-            if (paramIsAsNew || Exporter.SaveDocumentPath == null)
-            {
-                var saved = Exporter.SaveAsEditableFileWithDialog(BitmapManager.ActiveDocument, !paramIsAsNew);
-                _unsavedDocumentModified = _unsavedDocumentModified && !saved;
-            }
-            else
-            {
-                Exporter.SaveAsEditableFile(BitmapManager.ActiveDocument, Exporter.SaveDocumentPath);
-                _unsavedDocumentModified = false;
-            }
-        }
+    
 
         private void RemoveSwatch(object parameter)
         {
@@ -528,7 +387,7 @@ namespace PixiEditor.ViewModels
         {
             ActiveSelection = new Selection(Array.Empty<Coordinates>());
             RecenterZoombox = !RecenterZoombox;
-            _unsavedDocumentModified = true;
+            UnsavedDocumentModified = true;
         }
 
         public void AddSwatch(Color color)
@@ -675,7 +534,7 @@ namespace PixiEditor.ViewModels
         {
             ChangesController.AddChanges(new LayerChange(e.PixelsChanged, e.ChangedLayerIndex),
                 new LayerChange(e.OldPixelsValues, e.ChangedLayerIndex));
-            _unsavedDocumentModified = true;
+            UnsavedDocumentModified = true;
             if (BitmapManager.IsOperationTool())
                 AddSwatch(PrimaryColor);
         }
@@ -802,42 +661,6 @@ namespace PixiEditor.ViewModels
                 BitmapManager.MouseController.MouseMoved(cords);
         }
 
-        /// <summary>
-        ///     Generates new Layer and sets it as active one
-        /// </summary>
-        /// <param name="parameter"></param>
-        public void OpenNewFilePopup(object parameter)
-        {
-            NewFileDialog newFile = new NewFileDialog();
-            if (newFile.ShowDialog()) NewDocument(newFile.Width, newFile.Height);
-        }
-
-        /// <summary>
-        ///     Opens file from path.
-        /// </summary>
-        /// <param name="path"></param>
-        public void OpenFile(string path)
-        {
-            ImportFileDialog dialog = new ImportFileDialog();
-
-            if (path != null && File.Exists(path))
-                dialog.FilePath = path;
-
-            if (dialog.ShowDialog())
-            {
-                NewDocument(dialog.FileWidth, dialog.FileHeight, false);
-                BitmapManager.AddNewLayer("Image",Importer.ImportImage(dialog.FilePath, dialog.FileWidth, dialog.FileHeight));
-            }
-        }
-
-        public void NewDocument(int width, int height, bool addBaseLayer = true)
-        {
-            BitmapManager.ActiveDocument = new Document(width, height);
-            if(addBaseLayer)
-                BitmapManager.AddNewLayer("Base Layer");
-            ResetProgramStateValues();
-        }
-
         /// <summary>
         ///     Resets most variables and controller, so new documents can be handled.
         /// </summary>
@@ -849,7 +672,7 @@ namespace PixiEditor.ViewModels
             ActiveSelection = new Selection(Array.Empty<Coordinates>());
             RecenterZoombox = !RecenterZoombox;
             Exporter.SaveDocumentPath = null;
-            _unsavedDocumentModified = false;
+            UnsavedDocumentModified = false;
         }
 
         public void NewLayer(object parameter)
@@ -904,29 +727,5 @@ namespace PixiEditor.ViewModels
         }
 
         #endregion
-
-        #region SaveFile
-
-        /// <summary>
-        ///     Generates export dialog or saves directly if save data is known.
-        /// </summary>
-        /// <param name="parameter"></param>
-        private void ExportFile(object parameter)
-        {
-            WriteableBitmap bitmap = BitmapManager.GetCombinedLayersBitmap();
-            Exporter.Export(bitmap, new Size(bitmap.PixelWidth, bitmap.PixelHeight));
-        }
-
-        /// <summary>
-        ///     Returns true if file save is possible.
-        /// </summary>
-        /// <param name="property"></param>
-        /// <returns></returns>
-        private bool CanSave(object property)
-        {
-            return BitmapManager.ActiveDocument != null;
-        }
-
-        #endregion
     }
 }

+ 0 - 0
PixiEditor/Views/ConfirmationPopup.xaml → PixiEditor/Views/Dialogs/ConfirmationPopup.xaml


+ 0 - 0
PixiEditor/Views/ConfirmationPopup.xaml.cs → PixiEditor/Views/Dialogs/ConfirmationPopup.xaml.cs


+ 0 - 0
PixiEditor/Views/ImportFilePopup.xaml → PixiEditor/Views/Dialogs/ImportFilePopup.xaml


+ 0 - 0
PixiEditor/Views/ImportFilePopup.xaml.cs → PixiEditor/Views/Dialogs/ImportFilePopup.xaml.cs


+ 0 - 0
PixiEditor/Views/NewFilePopup.xaml → PixiEditor/Views/Dialogs/NewFilePopup.xaml


+ 0 - 0
PixiEditor/Views/NewFilePopup.xaml.cs → PixiEditor/Views/Dialogs/NewFilePopup.xaml.cs


+ 0 - 0
PixiEditor/Views/PopupTemplate.xaml → PixiEditor/Views/Dialogs/PopupTemplate.xaml


+ 0 - 0
PixiEditor/Views/PopupTemplate.xaml.cs → PixiEditor/Views/Dialogs/PopupTemplate.xaml.cs


+ 0 - 0
PixiEditor/Views/ResizeCanvasPopup.xaml → PixiEditor/Views/Dialogs/ResizeCanvasPopup.xaml


+ 0 - 0
PixiEditor/Views/ResizeCanvasPopup.xaml.cs → PixiEditor/Views/Dialogs/ResizeCanvasPopup.xaml.cs


+ 0 - 0
PixiEditor/Views/ResizeDocumentPopup.xaml → PixiEditor/Views/Dialogs/ResizeDocumentPopup.xaml


+ 0 - 0
PixiEditor/Views/ResizeDocumentPopup.xaml.cs → PixiEditor/Views/Dialogs/ResizeDocumentPopup.xaml.cs


+ 0 - 0
PixiEditor/Views/SaveFilePopup.xaml → PixiEditor/Views/Dialogs/SaveFilePopup.xaml


+ 0 - 0
PixiEditor/Views/SaveFilePopup.xaml.cs → PixiEditor/Views/Dialogs/SaveFilePopup.xaml.cs


+ 13 - 12
PixiEditor/Views/MainWindow.xaml

@@ -76,12 +76,12 @@
                     <Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource menuItemStyle}" />
                 </Menu.Resources>
                 <MenuItem Header="_File">
-                    <MenuItem InputGestureText="CTRL+N" Header="_New" Command="{Binding OpenNewFilePopupCommand}" />
-                    <MenuItem Header="_Open" InputGestureText="Ctrl+O" Command="{Binding OpenFileCommand}" />
-                    <MenuItem Header="_Save" InputGestureText="Ctrl+S" Command="{Binding SaveDocumentCommand}" />
+                    <MenuItem InputGestureText="CTRL+N" Header="_New" Command="{Binding IoSubViewModel.OpenNewFilePopupCommand}" />
+                    <MenuItem Header="_Open" InputGestureText="Ctrl+O" Command="{Binding IoSubViewModel.OpenFileCommand}" />
+                    <MenuItem Header="_Save" InputGestureText="Ctrl+S" Command="{Binding IoSubViewModel.SaveDocumentCommand}" />
                     <MenuItem Header="_Save As..." InputGestureText="Ctrl+Shift+S"
-                              Command="{Binding SaveDocumentCommand}" CommandParameter="AsNew" />
-                    <MenuItem Header="_Export" InputGestureText="Ctrl+Shift+Alt+S" Command="{Binding ExportFileCommand}" />
+                              Command="{Binding IoSubViewModel.SaveDocumentCommand}" CommandParameter="AsNew" />
+                    <MenuItem Header="_Export" InputGestureText="Ctrl+Shift+Alt+S" Command="{Binding IoSubViewModel.ExportFileCommand}" />
                     <Separator />
                     <MenuItem Header="_Exit" Command="{x:Static SystemCommands.CloseWindowCommand}" />
                 </MenuItem>
@@ -112,16 +112,16 @@
                 </MenuItem>
                 <MenuItem Header="_Help">
                     <MenuItem Header="Documentation" Command="{Binding OpenHyperlinkCommand}"
-                              CommandParameter="https://github.com/flabbet/PixiEditor/wiki"/>
+                              CommandParameter="https://github.com/PixiEditor/PixiEditor/wiki"/>
                     <MenuItem Header="Repository" Command="{Binding OpenHyperlinkCommand}"
-                              CommandParameter="https://github.com/flabbet/PixiEditor"/>
+                              CommandParameter="https://github.com/PixiEditor/PixiEditor"/>
                     <MenuItem Header="Shortcuts" Command="{Binding OpenHyperlinkCommand}"
-                              CommandParameter="https://github.com/flabbet/PixiEditor/wiki/Shortcuts"/>
+                              CommandParameter="https://github.com/PixiEditor/PixiEditor/wiki/Shortcuts"/>
                     <Separator/>
                     <MenuItem Header="License" Command="{Binding OpenHyperlinkCommand}"
-                              CommandParameter="https://github.com/flabbet/PixiEditor/blob/master/LICENSE"/>
+                              CommandParameter="https://github.com/PixiEditor/PixiEditor/blob/master/LICENSE"/>
                     <MenuItem Header="Third Party Licenses" Command="{Binding OpenHyperlinkCommand}"
-                              CommandParameter="https://github.com/flabbet/PixiEditor/wiki/Third-party-licenses"/>
+                              CommandParameter="https://github.com/PixiEditor/PixiEditor/wiki/Third-party-licenses"/>
                 </MenuItem>
             </Menu>
             <StackPanel DockPanel.Dock="Right" VerticalAlignment="Top" Orientation="Horizontal"
@@ -397,9 +397,10 @@
         <StackPanel Margin="10,0,0,0" VerticalAlignment="Center" Grid.Row="3"
                        Grid.Column="3" Orientation="Horizontal">
             <Button Style="{StaticResource BaseDarkButton}" 
-                    Visibility="{Binding UpdateReadyToInstall, Converter={StaticResource BoolToVisibilityConverter}}" FontSize="14" Height="20" Command="{Binding RestartApplicationCommand}">Restart</Button>
+                    Visibility="{Binding UpdateSubViewModel.UpdateReadyToInstall, Converter={StaticResource BoolToVisibilityConverter}}" FontSize="14" Height="20" 
+                    Command="{Binding UpdateSubViewModel.RestartApplicationCommand}">Restart</Button>
             <TextBlock VerticalAlignment="Center" Padding="10" HorizontalAlignment="Right"
-                       Foreground="White" FontSize="14"  Text="{Binding VersionText}" />
+                       Foreground="White" FontSize="14"  Text="{Binding UpdateSubViewModel.VersionText}" />
         </StackPanel>
     </Grid>
 </Window>

+ 0 - 0
PixiEditor/Views/AnchorPointPicker.xaml → PixiEditor/Views/UserControls/AnchorPointPicker.xaml


+ 0 - 0
PixiEditor/Views/AnchorPointPicker.xaml.cs → PixiEditor/Views/UserControls/AnchorPointPicker.xaml.cs


+ 24 - 24
PixiEditor/Views/EditableTextBlock.xaml → PixiEditor/Views/UserControls/EditableTextBlock.xaml

@@ -1,25 +1,25 @@
-<UserControl x:Class="PixiEditor.Views.EditableTextBlock"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
-             mc:Ignorable="d"
-             d:DesignHeight="60" d:DesignWidth="100">
-    <UserControl.Resources>
-        <converters:OppositeVisibilityConverter x:Key="OppositeVisibilityConverter" />
-    </UserControl.Resources>
-    <Grid>
-        <TextBlock Foreground="Snow" MouseDown="TextBlock_MouseDown"
-                   Visibility="{Binding Path=TextBlockVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
-                   Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" />
-        <TextBox Style="{StaticResource DarkTextBoxStyle}"
-                 LostFocus="TextBox_LostFocus"
-                 Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
-                 KeyDown="TextBox_KeyDown"
-                 LostKeyboardFocus="textBox_LostKeyboardFocus"
-                 Visibility="{Binding Path=TextBlockVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, 
-            Converter={StaticResource OppositeVisibilityConverter}}"
-                 Name="textBox" />
-    </Grid>
+<UserControl x:Class="PixiEditor.Views.EditableTextBlock"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
+             mc:Ignorable="d"
+             d:DesignHeight="60" d:DesignWidth="100">
+    <UserControl.Resources>
+        <converters:OppositeVisibilityConverter x:Key="OppositeVisibilityConverter" />
+    </UserControl.Resources>
+    <Grid>
+        <TextBlock Foreground="Snow" MouseDown="TextBlock_MouseDown"
+                   Visibility="{Binding Path=TextBlockVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
+                   Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" />
+        <TextBox Style="{StaticResource DarkTextBoxStyle}"
+                 LostFocus="TextBox_LostFocus"
+                 Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
+                 KeyDown="TextBox_KeyDown"
+                 LostKeyboardFocus="textBox_LostKeyboardFocus"
+                 Visibility="{Binding Path=TextBlockVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, 
+            Converter={StaticResource OppositeVisibilityConverter}}"
+                 Name="textBox" />
+    </Grid>
 </UserControl>

+ 100 - 100
PixiEditor/Views/EditableTextBlock.xaml.cs → PixiEditor/Views/UserControls/EditableTextBlock.xaml.cs

@@ -1,101 +1,101 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.Controllers.Shortcuts;
-
-namespace PixiEditor.Views
-{
-    /// <summary>
-    ///     Interaction logic for EditableTextBlock.xaml
-    /// </summary>
-    public partial class EditableTextBlock : UserControl
-    {
-        // Using a DependencyProperty as the backing store for TextBlockVisibility.  This enables animation, styling, binding, etc...
-        public static readonly DependencyProperty TextBlockVisibilityProperty =
-            DependencyProperty.Register("TextBlockVisibility", typeof(Visibility), typeof(EditableTextBlock),
-                new PropertyMetadata(Visibility.Visible));
-
-
-        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
-        public static readonly DependencyProperty TextProperty =
-            DependencyProperty.Register("Text", typeof(string), typeof(EditableTextBlock),
-                new PropertyMetadata(default(string)));
-
-        // Using a DependencyProperty as the backing store for EnableEditing.  This enables animation, styling, binding, etc...
-        public static readonly DependencyProperty EnableEditingProperty =
-            DependencyProperty.Register("IsEditing", typeof(bool), typeof(EditableTextBlock),
-                new PropertyMetadata(OnIsEditingChanged));
-
-        public EditableTextBlock()
-        {
-            InitializeComponent();
-        }
-
-        public Visibility TextBlockVisibility
-        {
-            get => (Visibility) GetValue(TextBlockVisibilityProperty);
-            set => SetValue(TextBlockVisibilityProperty, value);
-        }
-
-
-        public bool IsEditing
-        {
-            get => (bool) GetValue(EnableEditingProperty);
-            set => SetValue(EnableEditingProperty, value);
-        }
-
-
-        public string Text
-        {
-            get => (string) GetValue(TextProperty);
-            set => SetValue(TextProperty, value);
-        }
-
-        private static void OnIsEditingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
-        {
-            if ((bool) e.NewValue)
-            {
-                EditableTextBlock tb = (EditableTextBlock) d;
-                tb.EnableEditing();
-            }
-        }
-
-        public void EnableEditing()
-        {
-            ShortcutController.BlockShortcutExecution = true;
-            TextBlockVisibility = Visibility.Hidden;
-            IsEditing = true;
-            textBox.Focus();
-            textBox.SelectAll();
-        }
-
-        private void DisableEditing()
-        {
-            TextBlockVisibility = Visibility.Visible;
-            ShortcutController.BlockShortcutExecution = false;
-            IsEditing = false;
-        }
-
-
-        private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
-        {
-            if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2) EnableEditing();
-        }
-
-        private void TextBox_KeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.Key == Key.Enter) DisableEditing();
-        }
-
-        private void TextBox_LostFocus(object sender, RoutedEventArgs e)
-        {
-            DisableEditing();
-        }
-
-        private void textBox_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
-        {
-            DisableEditing();
-        }
-    }
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Controllers.Shortcuts;
+
+namespace PixiEditor.Views
+{
+    /// <summary>
+    ///     Interaction logic for EditableTextBlock.xaml
+    /// </summary>
+    public partial class EditableTextBlock : UserControl
+    {
+        // Using a DependencyProperty as the backing store for TextBlockVisibility.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty TextBlockVisibilityProperty =
+            DependencyProperty.Register("TextBlockVisibility", typeof(Visibility), typeof(EditableTextBlock),
+                new PropertyMetadata(Visibility.Visible));
+
+
+        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty TextProperty =
+            DependencyProperty.Register("Text", typeof(string), typeof(EditableTextBlock),
+                new PropertyMetadata(default(string)));
+
+        // Using a DependencyProperty as the backing store for EnableEditing.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty EnableEditingProperty =
+            DependencyProperty.Register("IsEditing", typeof(bool), typeof(EditableTextBlock),
+                new PropertyMetadata(OnIsEditingChanged));
+
+        public EditableTextBlock()
+        {
+            InitializeComponent();
+        }
+
+        public Visibility TextBlockVisibility
+        {
+            get => (Visibility) GetValue(TextBlockVisibilityProperty);
+            set => SetValue(TextBlockVisibilityProperty, value);
+        }
+
+
+        public bool IsEditing
+        {
+            get => (bool) GetValue(EnableEditingProperty);
+            set => SetValue(EnableEditingProperty, value);
+        }
+
+
+        public string Text
+        {
+            get => (string) GetValue(TextProperty);
+            set => SetValue(TextProperty, value);
+        }
+
+        private static void OnIsEditingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            if ((bool) e.NewValue)
+            {
+                EditableTextBlock tb = (EditableTextBlock) d;
+                tb.EnableEditing();
+            }
+        }
+
+        public void EnableEditing()
+        {
+            ShortcutController.BlockShortcutExecution = true;
+            TextBlockVisibility = Visibility.Hidden;
+            IsEditing = true;
+            textBox.Focus();
+            textBox.SelectAll();
+        }
+
+        private void DisableEditing()
+        {
+            TextBlockVisibility = Visibility.Visible;
+            ShortcutController.BlockShortcutExecution = false;
+            IsEditing = false;
+        }
+
+
+        private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2) EnableEditing();
+        }
+
+        private void TextBox_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Enter) DisableEditing();
+        }
+
+        private void TextBox_LostFocus(object sender, RoutedEventArgs e)
+        {
+            DisableEditing();
+        }
+
+        private void textBox_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
+        {
+            DisableEditing();
+        }
+    }
 }

+ 0 - 0
PixiEditor/Views/LayerItem.xaml → PixiEditor/Views/UserControls/LayerItem.xaml


+ 0 - 0
PixiEditor/Views/LayerItem.xaml.cs → PixiEditor/Views/UserControls/LayerItem.xaml.cs


+ 0 - 0
PixiEditor/Views/MainDrawingPanel.xaml → PixiEditor/Views/UserControls/MainDrawingPanel.xaml


+ 0 - 0
PixiEditor/Views/MainDrawingPanel.xaml.cs → PixiEditor/Views/UserControls/MainDrawingPanel.xaml.cs


+ 0 - 0
PixiEditor/Views/MenuButton.xaml → PixiEditor/Views/UserControls/MenuButton.xaml


+ 0 - 0
PixiEditor/Views/MenuButton.xaml.cs → PixiEditor/Views/UserControls/MenuButton.xaml.cs


+ 0 - 0
PixiEditor/Views/NumberInput.xaml → PixiEditor/Views/UserControls/NumberInput.xaml


+ 0 - 0
PixiEditor/Views/NumberInput.xaml.cs → PixiEditor/Views/UserControls/NumberInput.xaml.cs


+ 0 - 0
PixiEditor/Views/Rotatebox.xaml → PixiEditor/Views/UserControls/Rotatebox.xaml


+ 0 - 0
PixiEditor/Views/Rotatebox.xaml.cs → PixiEditor/Views/UserControls/Rotatebox.xaml.cs


+ 0 - 0
PixiEditor/Views/SizeInput.xaml → PixiEditor/Views/UserControls/SizeInput.xaml


+ 0 - 0
PixiEditor/Views/SizeInput.xaml.cs → PixiEditor/Views/UserControls/SizeInput.xaml.cs


+ 0 - 0
PixiEditor/Views/SizePicker.xaml → PixiEditor/Views/UserControls/SizePicker.xaml


+ 0 - 0
PixiEditor/Views/SizePicker.xaml.cs → PixiEditor/Views/UserControls/SizePicker.xaml.cs


+ 2 - 2
PixiEditorTests/ViewModelsTests/ViewModelMainTests.cs

@@ -46,7 +46,7 @@ namespace PixiEditorTests.ViewModelsTests
         {
             ViewModelMain viewModel = new ViewModelMain();
 
-            viewModel.NewDocument(5,5);
+            viewModel.IoSubViewModel.NewDocument(5,5);
 
             Assert.NotNull(viewModel.BitmapManager.ActiveDocument);
             Assert.Single(viewModel.BitmapManager.ActiveDocument.Layers);
@@ -117,7 +117,7 @@ namespace PixiEditorTests.ViewModelsTests
 
             Exporter.SaveDocumentPath = fileName;
 
-            viewModel.SaveDocumentCommand.Execute(null);
+            viewModel.IoSubViewModel.SaveDocumentCommand.Execute(null);
 
             Assert.True(File.Exists(fileName));