aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs65
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs26
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/ItemBase.cs77
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs52
4 files changed, 86 insertions, 134 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
index e35164cf7..1c47d2a97 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
@@ -11,71 +11,8 @@ namespace Tango.PPC.Common.Notifications
/// <summary>
/// Represents an AppBar item that can be inserted into the application header.
/// </summary>
- /// <seealso cref="System.IDisposable" />
- public abstract class AppBarItem : IDisposable
+ public abstract class AppBarItem : ItemBase
{
- /// <summary>
- /// Occurs when the AppBar item has been closed.
- /// </summary>
- public event EventHandler Closed;
- /// <summary>
- /// Occurs when the AppBar item has been pressed.
- /// </summary>
- public event EventHandler Preesed;
-
- /// <summary>
- /// Gets or sets the remove action.
- /// </summary>
- internal Action RemoveAction { get; set; }
-
- /// <summary>
- /// Gets or sets the AppBar view type.
- /// </summary>
- public abstract Type ViewType { get; }
-
- /// <summary>
- /// Gets or sets the close command.
- /// </summary>
- public RelayCommand CloseCommand { get; set; }
-
- /// <summary>
- /// Gets or sets the pressed command.
- /// </summary
- public RelayCommand PressedCommand { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AppBarItem"/> class.
- /// </summary>
- public AppBarItem()
- {
- CloseCommand = new RelayCommand(Close);
- PressedCommand = new RelayCommand(OnPreesed);
- }
-
- /// <summary>
- /// Called when the AppBar item has been pressed.
- /// </summary>
- protected virtual void OnPreesed()
- {
- Preesed?.Invoke(this, new EventArgs());
- }
-
- /// <summary>
- /// Called after the close command has been raised.
- /// </summary>
- public virtual void Close()
- {
- RemoveAction?.Invoke();
- Closed?.Invoke(this, new EventArgs());
- }
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- public void Dispose()
- {
- Close();
- }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
index 9063cef36..39cf2879f 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
@@ -88,6 +88,13 @@ namespace Tango.PPC.Common.Notifications
NotificationItem PushNotification(NotificationItem item);
/// <summary>
+ /// Pushes the notification.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <returns></returns>
+ NotificationItem PushNotification<T>() where T : NotificationItem;
+
+ /// <summary>
/// Displays the specified dialog in a modal design.
/// </summary>
/// <typeparam name="VM"></typeparam>
@@ -115,31 +122,12 @@ namespace Tango.PPC.Common.Notifications
Task<VM> ShowDialog<VM>() where VM : DialogViewVM;
/// <summary>
- /// Inserts the notification item to the bottom of the notifications collection.
- /// </summary>
- /// <param name="item">The item.</param>
- /// <param name="condition">A condition which determines if this item is still relevant.</param>
- /// <param name="autoCheck">Determines whether to perform automatic checking of the condition.</param>
- /// <param name="checkInterval">Determines how frequently the condition function will be invoked. (Default 1 second)</param>
- NotificationItem PushNotification(NotificationItem item, Func<bool> condition, bool autoCheck = true, TimeSpan? checkInterval = null);
-
- /// <summary>
/// Removed the specified notification item.
/// </summary>
/// <param name="item">The item.</param>
void PopNotification(NotificationItem item);
/// <summary>
- /// Invokes the notification items conditions.
- /// </summary>
- void InvokeNotificationItemsConditions();
-
- /// <summary>
- /// Gets the pop notification command.
- /// </summary>
- RelayCommand<NotificationItem> PopNotificationCommand { get; }
-
- /// <summary>
/// Gets a value indicating whether this instance is in global busy state.
/// </summary>
bool IsInGlobalBusyState { get; }
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/ItemBase.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/ItemBase.cs
new file mode 100644
index 000000000..12369948b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/ItemBase.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+using Tango.Core.Commands;
+
+namespace Tango.PPC.Common.Notifications
+{
+ public abstract class ItemBase : ExtendedObject, IDisposable
+ {
+ /// <summary>
+ /// Occurs when the item has been closed.
+ /// </summary>
+ public event EventHandler Closed;
+
+ /// <summary>
+ /// Occurs when the item has been pressed.
+ /// </summary>
+ public event EventHandler Pressed;
+
+ /// <summary>
+ /// Gets or sets the remove action.
+ /// </summary>
+ internal Action RemoveAction { get; set; }
+
+ /// <summary>
+ /// Gets or sets the view type.
+ /// </summary>
+ public abstract Type ViewType { get; }
+
+ /// <summary>
+ /// Gets or sets the close command.
+ /// </summary>
+ public RelayCommand CloseCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the pressed command.
+ /// </summary
+ public RelayCommand PressedCommand { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ItemBase"/> class.
+ /// </summary>
+ public ItemBase()
+ {
+ CloseCommand = new RelayCommand(Close);
+ PressedCommand = new RelayCommand(OnPreesed);
+ }
+
+ /// <summary>
+ /// Called when the item has been pressed.
+ /// </summary>
+ protected virtual void OnPreesed()
+ {
+ Pressed?.Invoke(this, new EventArgs());
+ }
+
+ /// <summary>
+ /// Called after the close command has been raised.
+ /// </summary>
+ public virtual void Close()
+ {
+ RemoveAction?.Invoke();
+ Closed?.Invoke(this, new EventArgs());
+ }
+
+ /// <summary>
+ /// Disposes the item.
+ /// </summary>
+ public void Dispose()
+ {
+ Close();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
index f5e319fa0..e1832090e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
@@ -12,58 +12,8 @@ namespace Tango.PPC.Common.Notifications
/// <summary>
/// Represents a base notification item.
/// </summary>
- /// <seealso cref="Tango.Core.ExtendedObject" />
- public abstract class NotificationItem : ExtendedObject, IDisposable
+ public abstract class NotificationItem : ItemBase
{
- /// <summary>
- /// Gets or sets the condition.
- /// </summary>
- internal Func<bool> Condition { get; set; }
- /// <summary>
- /// Gets or sets a value indicating whether [automatic check].
- /// </summary>
- internal bool AutoCheck { get; set; }
-
- /// <summary>
- /// Gets or sets the automatic check interval.
- /// </summary>
- internal TimeSpan AutoCheckInterval { get; set; }
-
- /// <summary>
- /// Gets or sets the remove action.
- /// </summary>
- internal Action RemoveAction { get; set; }
-
- /// <summary>
- /// Gets or sets the check timer.
- /// </summary>
- internal Timer Timer { get; set; }
-
- private String _message;
- /// <summary>
- /// Gets or sets the notification message.
- /// </summary>
- public String Message
- {
- get { return _message; }
- set { _message = value; RaisePropertyChangedAuto(); }
- }
-
- /// <summary>
- /// Gets or sets the type of the view associated with this notification item.
- /// </summary>
- public abstract Type ViewType { get; }
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- public void Dispose()
- {
- if (RemoveAction != null)
- {
- RemoveAction();
- }
- }
}
}