Browse Source

added show(message,title) that doesn't show in taskbar

pablo 3 years ago
parent
commit
6c1b9abc20
2 changed files with 20 additions and 2 deletions
  1. 1 1
      PixiEditor/App.xaml.cs
  2. 19 1
      PixiEditor/Models/Dialogs/ConfirmationDialog.cs

+ 1 - 1
PixiEditor/App.xaml.cs

@@ -17,7 +17,7 @@ namespace PixiEditor
 
             if (ViewModelMain.Current.BitmapManager.Documents.Any(x => !x.ChangesSaved))
             {
-                ConfirmationType confirmation = ConfirmationDialog.Show($"{e.ReasonSessionEnding} with unsaved data. Are you sure?");
+                ConfirmationType confirmation = ConfirmationDialog.Show($"{e.ReasonSessionEnding} with unsaved data. Are you sure?", $"{e.ReasonSessionEnding}");
                 e.Cancel = (confirmation == ConfirmationType.Canceled || confirmation == ConfirmationType.No);
             }
         }

+ 19 - 1
PixiEditor/Models/Dialogs/ConfirmationDialog.cs

@@ -1,10 +1,12 @@
 using PixiEditor.Models.Enums;
 using PixiEditor.Views;
-
+using System;
+
 namespace PixiEditor.Models.Dialogs
 {
     public static class ConfirmationDialog
     {
+        [Obsolete(message: "Use Show(message, title) instead.")]
         public static ConfirmationType Show(string message)
         {
             ConfirmationPopup popup = new ConfirmationPopup
@@ -17,6 +19,22 @@ namespace PixiEditor.Models.Dialogs
                 return popup.Result ? ConfirmationType.Yes : ConfirmationType.No;
             }
 
+            return ConfirmationType.Canceled;
+        }
+
+        public static ConfirmationType Show(string message, string title)
+        {
+            ConfirmationPopup popup = new ConfirmationPopup
+            {
+                Title = title,
+                Body = message,
+                ShowInTaskbar = false
+            };
+            if (popup.ShowDialog().GetValueOrDefault())
+            {
+                return popup.Result ? ConfirmationType.Yes : ConfirmationType.No;
+            }
+
             return ConfirmationType.Canceled;
         }
     }