aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2018-07-14 20:55:30 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2018-07-14 20:55:30 +0300
commit7f20e0b3199b469197364cb72436a4843b68b114 (patch)
treeb57d68e31faf3716dfedffc94cdf93eda6216031 /Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
parentfcb4ce31a11724d9bbc80b2dbaba3f322ff39825 (diff)
downloadTango-7f20e0b3199b469197364cb72436a4843b68b114.tar.gz
Tango-7f20e0b3199b469197364cb72436a4843b68b114.zip
Implemented PPC App Bar items.
Implemented new RelayCommand & RelayCommand<T>
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs63
1 files changed, 59 insertions, 4 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
index aaa5a9cf3..647fc1ef1 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
@@ -27,14 +27,14 @@ namespace Tango.PPC.UI.Notifications
/// <seealso cref="Tango.PPC.Common.Notifications.INotificationProvider" />
public class DefaultNotificationProvider : ExtendedObject, INotificationProvider
{
+ private ConcurrentQueue<PendingNotification<MessageBoxVM, bool>> _pendingMessageBoxes;
+ private ConcurrentQueue<PendingNotification<DialogAndView, DialogViewVM>> _pendingDialogs;
+
/// <summary>
/// Gets the collection of notification items.
/// </summary>
public ObservableCollection<NotificationItem> NotificationItems { get; private set; }
- private ConcurrentQueue<PendingNotification<MessageBoxVM, bool>> _pendingMessageBoxes;
- private ConcurrentQueue<PendingNotification<DialogAndView, DialogViewVM>> _pendingDialogs;
-
/// <summary>
/// Initializes a new instance of the <see cref="DefaultNotificationProvider"/> class.
/// </summary>
@@ -294,6 +294,9 @@ namespace Tango.PPC.UI.Notifications
}
}
+ /// <summary>
+ /// Gets the pop notification command.
+ /// </summary>
public RelayCommand<NotificationItem> PopNotificationCommand { get; private set; }
/// <summary>
@@ -309,7 +312,7 @@ namespace Tango.PPC.UI.Notifications
TangoIOC.Default.Inject(datacontext);
- view.Loaded += (_, __) =>
+ view.Loaded += (_, __) =>
{
view.DataContext = datacontext;
datacontext.OnShow();
@@ -333,6 +336,9 @@ namespace Tango.PPC.UI.Notifications
return result as T;
}
+ /// <summary>
+ /// Called when [dialog closed].
+ /// </summary>
private void OnDialogClosed()
{
CurrentDialog = null;
@@ -421,5 +427,54 @@ namespace Tango.PPC.UI.Notifications
/// Gets a value indicating whether this instance is in global busy state.
/// </summary>
public bool IsInGlobalBusyState { get; private set; }
+
+ private AppBarItem _currentAppBarItem;
+ /// <summary>
+ /// Gets the current application bar item.
+ /// </summary>
+ public AppBarItem CurrentAppBarItem
+ {
+ get { return _currentAppBarItem; }
+ set { _currentAppBarItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasAppBarItem)); }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether this instance has application bar item.
+ /// </summary>
+ public bool HasAppBarItem
+ {
+ get { return CurrentAppBarItem != null; }
+ }
+
+ /// <summary>
+ /// Pushes the application bar item.
+ /// </summary>
+ /// <param name="appBarItem">The application bar item.</param>
+ /// <returns></returns>
+ public AppBarItem PushAppBarItem(AppBarItem appBarItem)
+ {
+ CurrentAppBarItem = appBarItem;
+ appBarItem.RemoveAction = () => PopAppBarItem(appBarItem);
+ return appBarItem;
+ }
+
+ /// <summary>
+ /// Pushes the application bar item.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <returns></returns>
+ public AppBarItem PushAppBarItem<T>() where T : AppBarItem
+ {
+ return PushAppBarItem(Activator.CreateInstance<T>());
+ }
+
+ /// <summary>
+ /// Pops the application bar item.
+ /// </summary>
+ /// <param name="appBarItem">The application bar item.</param>
+ public void PopAppBarItem(AppBarItem appBarItem)
+ {
+ CurrentAppBarItem = null;
+ }
}
}