aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-17 19:06:13 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-17 19:06:13 +0300
commit7658a8546a9c33a76376dff3ab646f2aceaf0a01 (patch)
tree10c2cee7f96268e9052e19901f49f3e0a1e75d41 /Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications
parent22853e394b878578084db1062664c38c40e88d07 (diff)
downloadTango-7658a8546a9c33a76376dff3ab646f2aceaf0a01.tar.gz
Tango-7658a8546a9c33a76376dff3ab646f2aceaf0a01.zip
Working on PPC !!!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs42
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs69
2 files changed, 111 insertions, 0 deletions
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 9fc42c155..303392a68 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
+using Tango.Core.Commands;
namespace Tango.PPC.Common.Notifications
{
@@ -15,6 +16,16 @@ namespace Tango.PPC.Common.Notifications
public interface INotificationProvider
{
/// <summary>
+ /// Gets the collection of notification items.
+ /// </summary>
+ ObservableCollection<NotificationItem> NotificationItems { get; }
+
+ /// <summary>
+ /// Gets a value indicating whether this instance has notification items.
+ /// </summary>
+ bool HasNotificationItems { get; }
+
+ /// <summary>
/// Gets the current message box.
/// </summary>
MessageBoxVM CurrentMessageBox { get; }
@@ -47,5 +58,36 @@ namespace Tango.PPC.Common.Notifications
/// </summary>
/// <param name="message">The message.</param>
Task<bool> ShowQuestion(String message);
+
+ /// <summary>
+ /// Inserts the notification item to the bottom of the notifications collection.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ NotificationItem PushNotification(NotificationItem item);
+
+ /// <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; }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
new file mode 100644
index 000000000..f5e319fa0
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Timers;
+using System.Windows.Media;
+using Tango.Core;
+
+namespace Tango.PPC.Common.Notifications
+{
+ /// <summary>
+ /// Represents a base notification item.
+ /// </summary>
+ /// <seealso cref="Tango.Core.ExtendedObject" />
+ public abstract class NotificationItem : ExtendedObject, IDisposable
+ {
+ /// <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();
+ }
+ }
+ }
+}