-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Allow user to save files with validation errors
- Loading branch information
Showing
6 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/DayzServerTools.Application/Models/IConfirmationDialog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace DayzServerTools.Application.Models; | ||
|
||
public enum ConfirmationDialogResult | ||
{ | ||
None = 0, | ||
OK = 1, | ||
Cancel = 2, | ||
Yes = 6, | ||
No = 7 | ||
} | ||
|
||
public enum ConfirmationDialogButton | ||
{ | ||
OK = 0, | ||
OKCancel = 1, | ||
YesNoCancel = 3, | ||
YesNo = 4 | ||
} | ||
|
||
public interface IConfirmationDialog | ||
{ | ||
string Message { get; set; } | ||
string Title { get; set; } | ||
MessageDialogImage Image { get; set; } | ||
ConfirmationDialogButton Button { get; set; } | ||
|
||
ConfirmationDialogResult Show(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/DayzServerTools.Windows/Models/WindowsConfirmationDialog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Windows; | ||
|
||
using DayzServerTools.Application.Models; | ||
|
||
namespace DayzServerTools.Windows.Models; | ||
|
||
public class WindowsConfirmationDialog : IConfirmationDialog | ||
{ | ||
public string Message { get; set; } | ||
public string Title { get; set; } | ||
public MessageDialogImage Image { get; set; } = MessageDialogImage.None; | ||
public ConfirmationDialogButton Button { get; set; } = ConfirmationDialogButton.YesNo; | ||
|
||
public ConfirmationDialogResult Show() | ||
{ | ||
var button = (MessageBoxButton)Enum.Parse(typeof(MessageBoxButton), Button.ToString()); | ||
var image = (MessageBoxImage)Enum.Parse(typeof(MessageBoxImage), Image.ToString()); | ||
|
||
var res = MessageBox.Show(Message, Title, button, image); | ||
return (ConfirmationDialogResult)Enum.Parse(typeof(ConfirmationDialogResult), res.ToString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters