Browse Source

Update confirmation dialog

Equbuxu 3 years ago
parent
commit
26113bd7e1

+ 3 - 2
PixiEditor/ViewModels/SubViewModels/Main/DocumentViewModel.cs

@@ -8,7 +8,8 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
 {
 {
     public class DocumentViewModel : SubViewModel<ViewModelMain>
     public class DocumentViewModel : SubViewModel<ViewModelMain>
     {
     {
-        public const string ConfirmationDialogMessage = "Document was modified. Do you want to save changes?";
+        public const string ConfirmationDialogTitle = "Unsaved changes";
+        public const string ConfirmationDialogMessage = "The document was modified. Do you want to save changes?";
 
 
         public RelayCommand CenterContentCommand { get; set; }
         public RelayCommand CenterContentCommand { get; set; }
 
 
@@ -61,7 +62,7 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
         {
         {
             if (!document.ChangesSaved)
             if (!document.ChangesSaved)
             {
             {
-                ConfirmationType result = ConfirmationDialog.Show(ConfirmationDialogMessage);
+                ConfirmationType result = ConfirmationDialog.Show(ConfirmationDialogMessage, ConfirmationDialogTitle);
                 if (result == ConfirmationType.Yes)
                 if (result == ConfirmationType.Yes)
                 {
                 {
                     Owner.FileSubViewModel.SaveDocument(false);
                     Owner.FileSubViewModel.SaveDocument(false);

+ 1 - 1
PixiEditor/ViewModels/ViewModelMain.cs

@@ -321,7 +321,7 @@ namespace PixiEditor.ViewModels
 
 
             if (!BitmapManager.ActiveDocument.ChangesSaved)
             if (!BitmapManager.ActiveDocument.ChangesSaved)
             {
             {
-                result = ConfirmationDialog.Show(DocumentViewModel.ConfirmationDialogMessage);
+                result = ConfirmationDialog.Show(DocumentViewModel.ConfirmationDialogMessage, DocumentViewModel.ConfirmationDialogTitle);
                 if (result == ConfirmationType.Yes)
                 if (result == ConfirmationType.Yes)
                 {
                 {
                     FileSubViewModel.SaveDocument(false);
                     FileSubViewModel.SaveDocument(false);

+ 20 - 11
PixiEditor/Views/Dialogs/ConfirmationPopup.xaml

@@ -4,8 +4,8 @@
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         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/expression/2010/interactivity"
         xmlns:system="clr-namespace:System;assembly=System.Runtime" xmlns:behaviours="clr-namespace:PixiEditor.Helpers.Behaviours" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
-        mc:Ignorable="d"
-        Title="ConfirmationPopup" Name="popup" WindowStartupLocation="CenterScreen" Height="200" Width="500"
+        mc:Ignorable="d" d:Title="Unsaved changes"
+        Name="popup" WindowStartupLocation="CenterScreen" Height="180" Width="400"
         WindowStyle="None">
         WindowStyle="None">
 
 
     <WindowChrome.WindowChrome>
     <WindowChrome.WindowChrome>
@@ -22,30 +22,39 @@
         <i:Interaction.Behaviors>
         <i:Interaction.Behaviors>
             <behaviours:ClearFocusOnClickBehavior/>
             <behaviours:ClearFocusOnClickBehavior/>
         </i:Interaction.Behaviors>
         </i:Interaction.Behaviors>
-        <TextBlock Grid.Row="1" Text="{Binding Body, ElementName=popup}" HorizontalAlignment="Center"
-                   VerticalAlignment="Center" FontSize="18" Foreground="White" />
-        <DockPanel Grid.Row="0" Background="{StaticResource MainColor}">
-            <Button DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource CloseButtonStyle}"
+        <TextBlock Grid.Row="1" Text="{Binding Body, ElementName=popup}" HorizontalAlignment="Center" Margin="20,0" TextWrapping="Wrap" TextAlignment="Center"
+                   VerticalAlignment="Center" FontSize="15" Foreground="White" d:Text="The document was modified. Do you want to save changes?"/>
+
+        <Grid Grid.Row="0" Background="{StaticResource MainColor}">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition/>
+                <ColumnDefinition/>
+            </Grid.ColumnDefinitions>
+            <Button Grid.Column="1" HorizontalAlignment="Right" Style="{StaticResource CloseButtonStyle}"
                     WindowChrome.IsHitTestVisibleInChrome="True" ToolTip="Close"
                     WindowChrome.IsHitTestVisibleInChrome="True" ToolTip="Close"
                     Command="{Binding DataContext.CancelCommand, ElementName=popup}" />
                     Command="{Binding DataContext.CancelCommand, ElementName=popup}" />
-        </DockPanel>
+            <TextBlock TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" 
+                       Foreground="White" FontSize="15" Margin="5,0,0,0" Grid.Column="0" Grid.ColumnSpan="2"
+                       Text="{Binding ElementName=popup, Path=Title}"/>
+        </Grid>
+
         <StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center"
         <StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center"
-                    Margin="0,0,10,10">
-            <Button Margin="10,0,10,0" Height="30" Width="60" IsDefault="True"
+                    Margin="0,0,10,16">
+            <Button Margin="10,0,10,0" Height="28" Width="60" IsDefault="True"
                     Command="{Binding Path=DataContext.SetResultAndCloseCommand, ElementName=popup}"
                     Command="{Binding Path=DataContext.SetResultAndCloseCommand, ElementName=popup}"
                     Style="{StaticResource DarkRoundButton}" Content="Yes">
                     Style="{StaticResource DarkRoundButton}" Content="Yes">
                 <Button.CommandParameter>
                 <Button.CommandParameter>
                     <system:Boolean>True</system:Boolean>
                     <system:Boolean>True</system:Boolean>
                 </Button.CommandParameter>
                 </Button.CommandParameter>
             </Button>
             </Button>
-            <Button Height="30" Width="60"
+            <Button Height="28" Width="60"
                     Command="{Binding Path=DataContext.SetResultAndCloseCommand, ElementName=popup}"
                     Command="{Binding Path=DataContext.SetResultAndCloseCommand, ElementName=popup}"
                     Style="{StaticResource DarkRoundButton}" Content="No">
                     Style="{StaticResource DarkRoundButton}" Content="No">
                 <Button.CommandParameter>
                 <Button.CommandParameter>
                     <system:Boolean>False</system:Boolean>
                     <system:Boolean>False</system:Boolean>
                 </Button.CommandParameter>
                 </Button.CommandParameter>
             </Button>
             </Button>
-            <Button Margin="10,0,10,0" Height="30" Width="80" Style="{StaticResource DarkRoundButton}" Content="Cancel"
+            <Button Margin="10,0,10,0" Height="28" Width="80" Style="{StaticResource DarkRoundButton}" Content="Cancel"
                     Command="{Binding DataContext.CancelCommand, ElementName=popup}" />
                     Command="{Binding DataContext.CancelCommand, ElementName=popup}" />
         </StackPanel>
         </StackPanel>
     </Grid>
     </Grid>