From a775178c063082eb6a401b4254a046133840af03 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 14 Jun 2018 15:57:24 +0300 Subject: Working on PPC... --- .../Notifications/DefaultNotificationProvider.cs | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index 02e41e087..5e4bd7c30 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -14,22 +14,43 @@ using Tango.SharedUI.Helpers; namespace Tango.PPC.UI.Notifications { + /// + /// Represents the default PPC notification provider. + /// + /// + /// public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + /// + /// Represents a pending message box. + /// private class PendingMessageBox { + /// + /// Gets or sets the message view model. + /// public MessageBoxVM VM { get; set; } + + /// + /// Gets or sets the message task completion source. + /// public TaskCompletionSource CompletionSource { get; set; } } private ConcurrentQueue _pendingMessageBoxes; + /// + /// Initializes a new instance of the class. + /// public DefaultNotificationProvider() { _pendingMessageBoxes = new ConcurrentQueue(); } private MessageBoxVM _currentMessageBox; + /// + /// Gets the current message box if any. + /// public MessageBoxVM CurrentMessageBox { get { return _currentMessageBox; } @@ -41,6 +62,9 @@ namespace Tango.PPC.UI.Notifications } } + /// + /// Gets a value indicating whether a message box is available. + /// public bool HasMessageBox { get @@ -49,6 +73,11 @@ namespace Tango.PPC.UI.Notifications } } + /// + /// Shows an error message box. + /// + /// The message. + /// public Task ShowError(string message) { return ShowMessageBox(new MessageBoxVM() @@ -60,6 +89,11 @@ namespace Tango.PPC.UI.Notifications }); } + /// + /// Shows an information message box. + /// + /// The message. + /// public Task ShowInfo(string message) { return ShowMessageBox(new MessageBoxVM() @@ -71,6 +105,11 @@ namespace Tango.PPC.UI.Notifications }); } + /// + /// Shows warning message box. + /// + /// The message. + /// public Task ShowWarning(string message) { return ShowMessageBox(new MessageBoxVM() @@ -82,6 +121,11 @@ namespace Tango.PPC.UI.Notifications }); } + /// + /// Shows a question message box. + /// + /// The message. + /// public Task ShowQuestion(string message) { return ShowMessageBox(new MessageBoxVM() @@ -94,6 +138,11 @@ namespace Tango.PPC.UI.Notifications }); } + /// + /// Shows the message box. + /// + /// The view model. + /// private Task ShowMessageBox(MessageBoxVM vm) { TaskCompletionSource source = new TaskCompletionSource(); @@ -117,6 +166,9 @@ namespace Tango.PPC.UI.Notifications return source.Task; } + /// + /// Called when the message box has been closed. + /// private void OnMessageBoxClosed() { CurrentMessageBox = null; -- cgit v1.3.1