Browse Source

Update notice dialog

Equbuxu 3 years ago
parent
commit
b4d3deaa61

+ 0 - 11
PixiEditor/Models/Dialogs/NoticeDialog.cs

@@ -4,17 +4,6 @@ namespace PixiEditor.Models.Dialogs
 {
     public static class NoticeDialog
     {
-        public static void Show(string message)
-        {
-            NoticePopup popup = new()
-            {
-                Body = message,
-                Title = string.Empty
-            };
-
-            popup.ShowDialog();
-        }
-
         public static void Show(string message, string title)
         {
             NoticePopup popup = new()

+ 1 - 1
PixiEditor/ViewModels/SubViewModels/Main/DocumentViewModel.cs

@@ -9,7 +9,7 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
     public class DocumentViewModel : SubViewModel<ViewModelMain>
     {
         public const string ConfirmationDialogTitle = "Unsaved changes";
-        public const string ConfirmationDialogMessage = "The document was modified. Do you want to save changes?";
+        public const string ConfirmationDialogMessage = "The document has been modified. Do you want to save changes?";
 
         public RelayCommand CenterContentCommand { get; set; }
 

+ 2 - 2
PixiEditor/ViewModels/SubViewModels/Main/FileViewModel.cs

@@ -80,7 +80,7 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
 
             if (!File.Exists(path))
             {
-                NoticeDialog.Show("The file does no longer exist at that path");
+                NoticeDialog.Show("The file does not exist", "Failed to open the file");
                 RecentlyOpened.Remove(path);
                 return;
             }
@@ -176,7 +176,7 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
             }
             catch (CorruptedFileException ex)
             {
-                NoticeDialog.Show(ex.Message, "Failed to open file.");
+                NoticeDialog.Show(ex.Message, "Failed to open the file");
             }
             catch (OldFileFormatException)
             {

+ 2 - 2
PixiEditor/ViewModels/SubViewModels/Main/UpdateViewModel.cs

@@ -185,7 +185,7 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
                 }
                 catch (System.Net.Http.HttpRequestException)
                 {
-                    NoticeDialog.Show("Could not check if there's an update available");
+                    NoticeDialog.Show("Could not check if there is an update available", "Update check failed");
                 }
 
                 AskToInstall();
@@ -210,4 +210,4 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
             return selectedChannel;
         }
     }
-}
+}

+ 7 - 2
PixiEditor/Views/Dialogs/ConfirmationPopup.xaml

@@ -22,8 +22,13 @@
         <i:Interaction.Behaviors>
             <behaviours:ClearFocusOnClickBehavior/>
         </i:Interaction.Behaviors>
-        <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?"/>
+        <TextBlock Grid.Row="1" 
+                   Text="{Binding Body, ElementName=popup}" 
+                   HorizontalAlignment="Center" Margin="20,0" 
+                   TextWrapping="WrapWithOverflow" 
+                   TextTrimming="WordEllipsis"
+                   TextAlignment="Center"
+                   VerticalAlignment="Center" FontSize="15" Foreground="White" d:Text="The document has been modified. Do you want to save changes?"/>
 
         <Grid Grid.Row="0" Background="{StaticResource MainColor}">
             <Grid.ColumnDefinitions>

+ 17 - 11
PixiEditor/Views/Dialogs/NoticePopup.xaml

@@ -5,7 +5,7 @@
         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"
         mc:Ignorable="d" WindowStyle="None"
-        Title="NoticePopup" Height="200" Width="500"
+        d:Title="Notice" Height="160" Width="400"
         x:Name="popup">
 
     <WindowChrome.WindowChrome>
@@ -23,21 +23,27 @@
             <behaviours:ClearFocusOnClickBehavior/>
         </i:Interaction.Behaviors>
         <TextBlock Grid.Row="1" Text="{Binding Body, ElementName=popup}" TextAlignment="Center"
-                   VerticalAlignment="Center" FontSize="18" Foreground="White"
+                   VerticalAlignment="Center" FontSize="15" Foreground="White" Margin="20,0" d:Text="The file does not exist"
                        TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" />
-        <DockPanel Grid.Row="0" Background="{StaticResource MainColor}">
-            <TextBlock Text="{Binding Title, ElementName=popup}" 
-                       FontSize="18" Foreground="White"
-                       VerticalAlignment="Center" Margin="5,0,0,0"/>
-            <Button DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource CloseButtonStyle}"
+
+        <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"
                     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"
-                    Margin="0,0,10,10">
-            <Button Height="30" Width="60" IsDefault="True"
+                    Margin="0,0,0,16">
+            <Button Height="28" Width="70" IsDefault="True"
                     Click="OkButton_Close"
-                    Style="{StaticResource DarkRoundButton}" Content="Ok">
+                    Style="{StaticResource DarkRoundButton}" Content="Close">
             </Button>
         </StackPanel>
     </Grid>