Browse Source

Added export warning popup

Christoph Lettau 2 years ago
parent
commit
3015277f2a

+ 8 - 0
src/PixiEditor/Models/Dialogs/ExportFileDialog.cs

@@ -78,11 +78,19 @@ internal class ExportFileDialog : CustomDialog
     {
         ExportFilePopup popup = new ExportFilePopup(FileWidth, FileHeight);
         popup.ShowDialog();
+
         if (popup.DialogResult == true)
         {
             FileWidth = popup.SaveWidth;
             FileHeight = popup.SaveHeight;
             FilePath = popup.SavePath;
+
+            if (ChosenFormat.ToString() != "pixi")
+            {
+                ExportWarningPopup exportWarningPopup = new ExportWarningPopup();
+                exportWarningPopup.ShowDialog();
+            }
+
             ChosenFormat = popup.SaveFormat;
         }
 

+ 39 - 0
src/PixiEditor/Views/Dialogs/ExportWarningPopup.xaml

@@ -0,0 +1,39 @@
+<Window x:Class="PixiEditor.Views.Dialogs.ExportWarningPopup"
+        x:ClassModifier="internal"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:system="clr-namespace:System;assembly=System.Runtime" 
+        xmlns:behaviours="clr-namespace:PixiEditor.Helpers.Behaviours" 
+        xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+        xmlns:dial="clr-namespace:PixiEditor.Views.Dialogs"
+        mc:Ignorable="d" WindowStyle="None"
+        d:Title="Notice" Height="225" Width="400" MinHeight="225" MinWidth="400"
+        WindowStartupLocation="CenterScreen"
+        x:Name="popup">
+
+    <WindowChrome.WindowChrome>
+        <WindowChrome CaptionHeight="32"  GlassFrameThickness="0.1"
+                      ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
+    </WindowChrome.WindowChrome>
+
+    <DockPanel Background="{StaticResource AccentColor}" Focusable="True">
+        <i:Interaction.Behaviors>
+            <behaviours:ClearFocusOnClickBehavior/>
+        </i:Interaction.Behaviors>
+
+        <dial:DialogTitleBar DockPanel.Dock="Top"
+            TitleText="What you should know about exporting" CloseCommand="{Binding DataContext.CancelCommand, ElementName=popup}" />
+
+        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,15">
+            <Button Width="70" IsDefault="True" Click="OkButton_Close" Style="{StaticResource DarkRoundButton}" Content="Close"/>
+        </StackPanel>
+
+        <TextBlock 
+            Grid.Row="1" Text="You're about to export your project as a regular picture. Please note that this will summarize all layers into one. In order to make sure you can properly continue working on this project, click on 'File' > 'Save as...' and save it as a .pixi file." TextAlignment="Center"
+            VerticalAlignment="Center" FontSize="15" Foreground="White" Margin="20,0"
+            d:Text="You're about to export your project as a regular picture. Please note that this will summarize all layers into one. In order to make sure you can properly continue working on this project, click on 'File' > 'Save as...' and save it as a .pixi file."
+            TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" />
+    </DockPanel>
+</Window>

+ 45 - 0
src/PixiEditor/Views/Dialogs/ExportWarningPopup.xaml.cs

@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace PixiEditor.Views.Dialogs;
+/// <summary>
+/// Interaktionslogik für ExportWarningPopup.xaml
+/// </summary>
+internal partial class ExportWarningPopup : Window
+{
+    public static readonly DependencyProperty BodyProperty =
+        DependencyProperty.Register(nameof(Body), typeof(string), typeof(ExportWarningPopup));
+
+    public new string Title
+    {
+        get => base.Title;
+        set => base.Title = value;
+    }
+
+    public string Body
+    {
+        get => (string)GetValue(BodyProperty);
+        set => SetValue(BodyProperty, value);
+    }
+
+    public ExportWarningPopup()
+    {
+        InitializeComponent();
+    }
+
+    private void OkButton_Close(object sender, RoutedEventArgs e)
+    {
+        Close();
+    }
+}

+ 1 - 0
src/PixiEditor/Views/Dialogs/NoticePopup.g.cs

@@ -0,0 +1 @@
+