aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs80
1 files changed, 80 insertions, 0 deletions
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
{
+ /// <summary>
+ /// Represents the default Machine Studio <see cref="INotificationProvider">Notification Provider</see>.
+ /// </summary>
+ /// <seealso cref="Tango.Core.ExtendedObject" />
+ /// <seealso cref="Tango.MachineStudio.Common.Notifications.INotificationProvider" />
public class DefaultNotificationProvider : ExtendedObject, INotificationProvider
{
+ /// <summary>
+ /// The view types
+ /// </summary>
private static List<Type> viewTypes;
+ /// <summary>
+ /// Gets the collection of active task items.
+ /// </summary>
public ObservableCollection<TaskItem> TaskItems { get; private set; }
+ /// <summary>
+ /// Gets a value indicating whether there are any queued task items.
+ /// </summary>
public bool HasTaskItems
{
get { return TaskItems.Count > 0; }
}
+ /// <summary>
+ /// The current task item
+ /// </summary>
private TaskItem _currentTaskItem;
+ /// <summary>
+ /// Gets the current displayed task item.
+ /// </summary>
public TaskItem CurrentTaskItem
{
get { return _currentTaskItem; }
set { _currentTaskItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasTaskItems)); }
}
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DefaultNotificationProvider"/> class.
+ /// </summary>
public DefaultNotificationProvider()
{
TaskItems = new ObservableCollection<TaskItem>();
}
+ /// <summary>
+ /// Display a message box.
+ /// </summary>
+ /// <param name="icon">The icon.</param>
+ /// <param name="iconColor">Color of the icon.</param>
+ /// <param name="message">The message.</param>
+ /// <param name="hasCancel">if set to <c>true</c> displays the cancel button.</param>
+ /// <returns></returns>
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;
}
+ /// <summary>
+ /// Creates a new instance of the specified View type and displays it as a modal dialog.
+ /// </summary>
+ /// <typeparam name="View">The type of the view.</typeparam>
+ /// <typeparam name="VM">The type of the view model.</typeparam>
+ /// <param name="onAccept">Accept button callback.</param>
+ /// <param name="onCancel">Cancel button callback.</param>
public void ShowModalDialog<View, VM>(Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM
{
var view = Activator.CreateInstance<View>();
@@ -97,6 +135,13 @@ namespace Tango.MachineStudio.UI.Notifications
MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden;
}
+ /// <summary>
+ /// Creates a new view by a naming convention of the specified view model type.
+ /// </summary>
+ /// <typeparam name="VM">The type of the view model.</typeparam>
+ /// <param name="onAccept">Accept button callback.</param>
+ /// <param name="onCancel">Cancel button callback.</param>
+ /// <exception cref="NullReferenceException">Could not locate view " + viewName</exception>
public void ShowModalDialog<VM>(Action<VM> 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;
}
+ /// <summary>
+ /// Creates a new view by a naming convention of the specified view model type.
+ /// </summary>
+ /// <typeparam name="VM">The type of the view model.</typeparam>
+ /// <param name="onAccept">Accept button callback.</param>
public void ShowModalDialog<VM>(Action<VM> onAccept) where VM : DialogViewVM
{
ShowModalDialog<VM>(onAccept, null);
}
+ /// <summary>
+ /// Shows an error message box.
+ /// </summary>
+ /// <param name="message">The message.</param>
public void ShowError(string message)
{
ShowMessageBox(PackIconKind.Exclamation, Brushes.Red, message, false);
}
+ /// <summary>
+ /// Shows an information message box.
+ /// </summary>
+ /// <param name="message">The message.</param>
public void ShowInfo(string message)
{
ShowMessageBox(PackIconKind.Information, Brushes.Black, message, false);
}
+ /// <summary>
+ /// Shows a question message box.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <returns></returns>
public bool ShowQuestion(string message)
{
return ShowMessageBox(PackIconKind.CommentQuestionOutline, Brushes.Black, message, true).Value;
}
+ /// <summary>
+ /// Shows warning message box.
+ /// </summary>
+ /// <param name="message">The message.</param>
public void ShowWarning(string message)
{
ShowMessageBox(PackIconKind.Exclamation, Brushes.DarkOrange, message, false);
}
+ /// <summary>
+ /// Pushes the specified task item to the queue.
+ /// </summary>
+ /// <param name="taskItem">The task item.</param>
public void PushTaskItem(TaskItem taskItem)
{
TaskItems.Add(taskItem);
CurrentTaskItem = taskItem;
}
+ /// <summary>
+ /// Create and push a new task item from the specified message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <returns></returns>
public TaskItem PushTaskItem(string message)
{
TaskItem item = new TaskItem(this);
@@ -193,6 +269,10 @@ namespace Tango.MachineStudio.UI.Notifications
return item;
}
+ /// <summary>
+ /// Removed the specified task item from the queue.
+ /// </summary>
+ /// <param name="taskItem">The task item.</param>
public void PopTaskItem(TaskItem taskItem)
{
TaskItems.Remove(taskItem);