Skip to content

Commit

Permalink
added show(message,title) that doesn't show in taskbar
Browse files Browse the repository at this point in the history
  • Loading branch information
marce1994 committed Oct 18, 2021
1 parent 798339d commit 6c1b9ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PixiEditor/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override void OnSessionEnding(SessionEndingCancelEventArgs e)

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);
}
}
Expand Down
20 changes: 19 additions & 1 deletion PixiEditor/Models/Dialogs/ConfirmationDialog.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,6 +19,22 @@ public static ConfirmationType Show(string message)
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;
}
}
Expand Down

0 comments on commit 6c1b9ab

Please sign in to comment.