From a20fd4bd769aeccd1fd1f20273f895c92a5b5bb8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Jan 2018 15:24:49 +0200 Subject: Added code comments for: MachineStudio.Common. --- .../Notifications/DialogViewVM.cs | 23 ++++++- .../Notifications/INotificationProvider.cs | 71 +++++++++++++++++++++- .../Notifications/TaskItem.cs | 21 +++++++ 3 files changed, 112 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs index e5e4cac78..5fcd63071 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs @@ -8,11 +8,18 @@ using Tango.SharedUI; namespace Tango.MachineStudio.Common.Notifications { + /// + /// Represents a dialog view model base class. + /// + /// public abstract class DialogViewVM : ViewModel { public event Action Accepted; public event Action Canceled; + /// + /// Initializes a new instance of the class. + /// public DialogViewVM() { CanClose = true; @@ -20,25 +27,39 @@ namespace Tango.MachineStudio.Common.Notifications } private bool _canClose; - + /// + /// Gets or sets a value indicating whether this dialog can be closed. + /// public bool CanClose { get { return _canClose; } set { _canClose = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + /// + /// Gets or sets the close command. + /// public RelayCommand CloseCommand { get; set; } + /// + /// Called when the dialog has been shown. + /// public virtual void OnShow() { } + /// + /// Invokes the event. + /// protected virtual void Accept() { Accepted?.Invoke(); } + /// + /// Invokes the event. + /// protected virtual void Cancel() { Canceled?.Invoke(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs index 937a39ec2..30e5626a1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs @@ -10,34 +10,101 @@ using System.Windows.Media; namespace Tango.MachineStudio.Common.Notifications { + /// + /// Represents the Machine Studio user notification provider responsible for displaying information, alerts and dialogs to the user. + /// public interface INotificationProvider { + /// + /// Gets the collection of active task items. + /// ObservableCollection TaskItems { get; } + /// + /// Gets the current displayed task item. + /// TaskItem CurrentTaskItem { get; } + /// + /// Gets a value indicating whether there are any queued task items. + /// bool HasTaskItems { get; } + /// + /// Pushes the specified task item to the queue. + /// + /// The task item. void PushTaskItem(TaskItem taskItem); + /// + /// Create and push a new task item from the specified message. + /// + /// The message. + /// TaskItem PushTaskItem(String message); + /// + /// Removed the specified task item from the queue. + /// + /// The task item. void PopTaskItem(TaskItem taskItem); + /// + /// Creates a new instance of the specified View type and displays it as a modal dialog. + /// + /// The type of the view. + /// The type of the view model. + /// Accept button callback. + /// Cancel button callback. void ShowModalDialog(Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; + /// + /// Creates a new view by a naming convention of the specified view model type. + /// + /// The type of the view model. + /// Accept button callback. + /// Cancel button callback. void ShowModalDialog(Action onAccept, Action onCancel) where VM : DialogViewVM; + /// + /// Creates a new view by a naming convention of the specified view model type. + /// + /// The type of the view model. + /// Accept button callback. void ShowModalDialog(Action onAccept) where VM : DialogViewVM; - bool? ShowDialog(PackIconKind icon, Brush iconColor, String message, bool hasCancel); + /// + /// Display a message box. + /// + /// The icon. + /// Color of the icon. + /// The message. + /// if set to true displays the cancel button. + /// + bool? ShowMessageBox(PackIconKind icon, Brush iconColor, String message, bool hasCancel); + /// + /// Shows an information message box. + /// + /// The message. void ShowInfo(String message); - void ShowWarnning(String message); + /// + /// Shows warning message box. + /// + /// The message. + void ShowWarning(String message); + /// + /// Shows an error message box. + /// + /// The message. void ShowError(String message); + /// + /// Shows a question message box. + /// + /// The message. bool ShowQuestion(String message); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs index 0cf5e2c8e..110fbfa74 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs @@ -7,32 +7,53 @@ using Tango.Core; namespace Tango.MachineStudio.Common.Notifications { + /// + /// Represents a Machine Studio "work-bar" item. + /// + /// + /// public class TaskItem : ExtendedObject, IDisposable { private INotificationProvider _notificationProvider; + /// + /// Initializes a new instance of the class. + /// + /// The notification provider. public TaskItem(INotificationProvider notificationProvider) { _notificationProvider = notificationProvider; } private String _message; + /// + /// Gets or sets the message. + /// public String Message { get { return _message; } set { _message = value; RaisePropertyChangedAuto(); } } + /// + /// Removed this item from the queue. + /// public void Pop() { _notificationProvider.PopTaskItem(this); } + /// + /// Pushes this item to the queue. + /// public void Push() { _notificationProvider.PushTaskItem(this); } + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// public void Dispose() { Pop(); -- cgit v1.3.1