Browse Source

Added Export As option

flabbet 5 years ago
parent
commit
5eaf57b902
2 changed files with 4 additions and 2 deletions
  1. 2 1
      PixiEditor/ViewModels/ViewModelMain.cs
  2. 2 1
      PixiEditor/Views/MainWindow.xaml

+ 2 - 1
PixiEditor/ViewModels/ViewModelMain.cs

@@ -349,6 +349,7 @@ namespace PixiEditor.ViewModels
 
 
         private void MouseDown(object parameter)
         private void MouseDown(object parameter)
         {
         {
+            if (BitmapUtility.Layers.Count == 0) return;
             if(SelectedTool == ToolType.ColorPicker)
             if(SelectedTool == ToolType.ColorPicker)
             {
             {
                 ExecuteColorPicker();
                 ExecuteColorPicker();
@@ -420,7 +421,7 @@ namespace PixiEditor.ViewModels
         private void SaveFile(object parameter)
         private void SaveFile(object parameter)
         {
         {
             WriteableBitmap bitmap = BitmapUtility.GetCombinedLayersBitmap();
             WriteableBitmap bitmap = BitmapUtility.GetCombinedLayersBitmap();
-            if (Exporter.SavePath == null)
+            if (Exporter.SavePath == null || (string)parameter == "AsNew")
             {
             {
                 Exporter.Export(FileType.PNG, bitmap, new Size(bitmap.PixelWidth, bitmap.PixelHeight));
                 Exporter.Export(FileType.PNG, bitmap, new Size(bitmap.PixelWidth, bitmap.PixelHeight));
             }
             }

+ 2 - 1
PixiEditor/Views/MainWindow.xaml

@@ -47,7 +47,8 @@
                 <vws:MenuButton.Item>
                 <vws:MenuButton.Item>
                     <StackPanel>
                     <StackPanel>
                         <Button Style="{StaticResource MenuInsideButtonStyle}" Content="New" Command="{Binding GenerateDrawAreaCommand}"/>
                         <Button Style="{StaticResource MenuInsideButtonStyle}" Content="New" Command="{Binding GenerateDrawAreaCommand}"/>
-                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Save" Command="{Binding SaveFileCommand}"/>
+                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Export" Command="{Binding SaveFileCommand}"/>
+                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Export As..." Command="{Binding SaveFileCommand}" CommandParameter="AsNew"/>
                         <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Open" Command="{Binding OpenFileCommand}"/>
                         <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Open" Command="{Binding OpenFileCommand}"/>
                     </StackPanel>
                     </StackPanel>
                 </vws:MenuButton.Item>
                 </vws:MenuButton.Item>