aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-17 16:43:40 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-17 16:43:40 +0200
commitae1cfd30f1efbd385eac04b3d02fa1ed161058a3 (patch)
tree5b77d7484e80491b06f1b726a57a61c782b5569e /Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications
parent8270aa37dee33cda98603a995de823df393f7294 (diff)
downloadTango-ae1cfd30f1efbd385eac04b3d02fa1ed161058a3.tar.gz
Tango-ae1cfd30f1efbd385eac04b3d02fa1ed161058a3.zip
Add AppButtons to PPC.
Implemented Stop & Start job app buttons!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppButton.cs112
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs17
2 files changed, 129 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppButton.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppButton.cs
new file mode 100644
index 000000000..d5d6a0891
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppButton.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+using Tango.Core.Commands;
+using Tango.Core.DI;
+
+namespace Tango.PPC.Common.Notifications
+{
+ /// <summary>
+ /// Represents an app button that will be displayed in the layout view.
+ /// </summary>
+ /// <seealso cref="ExtendedObject" />
+ public abstract class AppButton : ExtendedObject
+ {
+ /// <summary>
+ /// Occurs when the button has been pressed.
+ /// </summary>
+ public event Action Pressed;
+
+ private String _text;
+ /// <summary>
+ /// Gets or sets the text.
+ /// </summary>
+ public String Text
+ {
+ get { return _text; }
+ set { _text = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isEnabled;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is enabled.
+ /// </summary>
+ public bool IsEnabled
+ {
+ get { return _isEnabled; }
+ set { _isEnabled = value; RaisePropertyChangedAuto(); }
+ }
+
+ private RelayCommand _command;
+ /// <summary>
+ /// Gets or sets the command.
+ /// </summary>
+ public RelayCommand Command
+ {
+ get { return _command; }
+ set { _command = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AppButton"/> class.
+ /// </summary>
+ public AppButton()
+ {
+
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AppButton"/> class.
+ /// </summary>
+ /// <param name="text">The text.</param>
+ /// <param name="isEnabled">if set to <c>true</c> [is enabled].</param>
+ /// <param name="onExecute">The on execute.</param>
+ /// <param name="canExecute">The can execute.</param>
+ public AppButton(String text, bool isEnabled) : this()
+ {
+ Text = text;
+ IsEnabled = isEnabled;
+ Command = new RelayCommand(() =>
+ {
+ Pressed?.Invoke();
+ });
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AppButton"/> class.
+ /// </summary>
+ /// <param name="text">The text.</param>
+ /// <param name="command">The command.</param>
+ public AppButton(String text, RelayCommand command) : this(text, true)
+ {
+ Command = command;
+ }
+
+ /// <summary>
+ /// Invalidates the button state.
+ /// </summary>
+ public void RaiseCanExecute()
+ {
+ Command.RaiseCanExecuteChanged();
+ }
+
+ /// <summary>
+ /// Pops this instance.
+ /// </summary>
+ public void Pop()
+ {
+ TangoIOC.Default.GetInstance<INotificationProvider>().PopAppButton(this);
+ }
+
+ /// <summary>
+ /// Pushes this instance.
+ /// </summary>
+ public void Push()
+ {
+ TangoIOC.Default.GetInstance<INotificationProvider>().PushAppButton(this);
+ }
+ }
+}
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 c43e96b10..c4e82b7d2 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
@@ -58,6 +58,11 @@ namespace Tango.PPC.Common.Notifications
FrameworkElement CurrentDialog { get; }
/// <summary>
+ /// Gets the current app button.
+ /// </summary>
+ AppButton CurrentAppButton { get; }
+
+ /// <summary>
/// Gets a value indicating whether this instance has a dialog.
/// </summary>
bool HasDialog { get; }
@@ -203,5 +208,17 @@ namespace Tango.PPC.Common.Notifications
/// Gets or sets a value indicating whether to allow notifications visibility.
/// </summary>
bool NotificationsVisible { get; set; }
+
+ /// <summary>
+ /// Pushes the app button.
+ /// </summary>
+ /// <param name="appButton">The app button.</param>
+ void PushAppButton(AppButton appButton);
+
+ /// <summary>
+ /// Pops the app button.
+ /// </summary>
+ /// <param name="appButton">The app button.</param>
+ void PopAppButton(AppButton appButton);
}
}