From 48071f784b19ea8ed2859fb03642b8cc856406b1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Jan 2018 15:49:39 +0200 Subject: Added code comments for: MachineStudio.UI --- .../Notifications/DefaultNotificationProvider.cs | 80 ++++++++++++++++++++++ .../Notifications/DialogWindow.xaml.cs | 2 - 2 files changed, 80 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index 6b6d59c63..8ca933397 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -13,30 +13,61 @@ using System.Collections.ObjectModel; namespace Tango.MachineStudio.UI.Notifications { + /// + /// Represents the default Machine Studio Notification Provider. + /// + /// + /// public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + /// + /// The view types + /// private static List viewTypes; + /// + /// Gets the collection of active task items. + /// public ObservableCollection TaskItems { get; private set; } + /// + /// Gets a value indicating whether there are any queued task items. + /// public bool HasTaskItems { get { return TaskItems.Count > 0; } } + /// + /// The current task item + /// private TaskItem _currentTaskItem; + /// + /// Gets the current displayed task item. + /// public TaskItem CurrentTaskItem { get { return _currentTaskItem; } set { _currentTaskItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasTaskItems)); } } + /// + /// Initializes a new instance of the class. + /// public DefaultNotificationProvider() { TaskItems = new ObservableCollection(); } + /// + /// Display a message box. + /// + /// The icon. + /// Color of the icon. + /// The message. + /// if set to true displays the cancel button. + /// public bool? ShowMessageBox(PackIconKind icon, Brush iconColor, string message, bool hasCancel) { MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; @@ -55,6 +86,13 @@ namespace Tango.MachineStudio.UI.Notifications return result; } + /// + /// 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. public void ShowModalDialog(Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM { var view = Activator.CreateInstance(); @@ -97,6 +135,13 @@ namespace Tango.MachineStudio.UI.Notifications MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; } + /// + /// 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. + /// Could not locate view " + viewName public void ShowModalDialog(Action onAccept, Action onCancel) where VM : DialogViewVM { String viewName = typeof(VM).Name.Replace("VM", ""); @@ -154,37 +199,68 @@ namespace Tango.MachineStudio.UI.Notifications MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; } + /// + /// Creates a new view by a naming convention of the specified view model type. + /// + /// The type of the view model. + /// Accept button callback. public void ShowModalDialog(Action onAccept) where VM : DialogViewVM { ShowModalDialog(onAccept, null); } + /// + /// Shows an error message box. + /// + /// The message. public void ShowError(string message) { ShowMessageBox(PackIconKind.Exclamation, Brushes.Red, message, false); } + /// + /// Shows an information message box. + /// + /// The message. public void ShowInfo(string message) { ShowMessageBox(PackIconKind.Information, Brushes.Black, message, false); } + /// + /// Shows a question message box. + /// + /// The message. + /// public bool ShowQuestion(string message) { return ShowMessageBox(PackIconKind.CommentQuestionOutline, Brushes.Black, message, true).Value; } + /// + /// Shows warning message box. + /// + /// The message. public void ShowWarning(string message) { ShowMessageBox(PackIconKind.Exclamation, Brushes.DarkOrange, message, false); } + /// + /// Pushes the specified task item to the queue. + /// + /// The task item. public void PushTaskItem(TaskItem taskItem) { TaskItems.Add(taskItem); CurrentTaskItem = taskItem; } + /// + /// Create and push a new task item from the specified message. + /// + /// The message. + /// public TaskItem PushTaskItem(string message) { TaskItem item = new TaskItem(this); @@ -193,6 +269,10 @@ namespace Tango.MachineStudio.UI.Notifications return item; } + /// + /// Removed the specified task item from the queue. + /// + /// The task item. public void PopTaskItem(TaskItem taskItem) { TaskItems.Remove(taskItem); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs index d1bc0564b..8ed1a4946 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs @@ -36,7 +36,5 @@ namespace Tango.MachineStudio.UI.Windows // Using a DependencyProperty as the backing store for InnerContent. This enables animation, styling, binding, etc... public static readonly DependencyProperty InnerContentProperty = DependencyProperty.Register("InnerContent", typeof(FrameworkElement), typeof(DialogWindow), new PropertyMetadata(null)); - - } } -- cgit v1.3.1