aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2018-07-15 01:04:34 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2018-07-15 01:04:34 +0300
commitcc425e019d3a7d3494ac15ffe213b6b47b1c64ed (patch)
tree6db5ec969f92f91c2d05af55216bc4a267cc2370 /Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications
parent64bcf92608faae31b7cd31ac3da5c7d1d7ebcd0b (diff)
downloadTango-cc425e019d3a7d3494ac15ffe213b6b47b1c64ed.tar.gz
Tango-cc425e019d3a7d3494ac15ffe213b6b47b1c64ed.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/NotificationItem.cs6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs61
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml55
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml.cs28
4 files changed, 149 insertions, 1 deletions
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 e1832090e..2f74024f3 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
@@ -14,6 +14,10 @@ namespace Tango.PPC.Common.Notifications
/// </summary>
public abstract class NotificationItem : ItemBase
{
-
+ protected override void OnPreesed()
+ {
+ base.OnPreesed();
+ Close();
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs
new file mode 100644
index 000000000..5e120ab8c
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.Notifications.NotificationItems
+{
+ public class MessageNotificationItem : NotificationItem
+ {
+ public enum MessageNotificationItemTypes
+ {
+ Info,
+ Success,
+ Warning,
+ Error,
+ }
+
+ private String _message;
+ public String Message
+ {
+ get { return _message; }
+ set { _message = value; RaisePropertyChangedAuto(); }
+ }
+
+ private MessageNotificationItemTypes _messageType;
+
+ public MessageNotificationItemTypes MessageType
+ {
+ get { return _messageType; }
+ set { _messageType = value; RaisePropertyChangedAuto(); }
+ }
+
+ public override Type ViewType
+ {
+ get { return typeof(MessageNotificationItemView); }
+ }
+
+ public MessageNotificationItem() : base()
+ {
+
+ }
+
+ public MessageNotificationItem(String message, MessageNotificationItemTypes type, Action pressed) : this()
+ {
+ Message = message;
+ MessageType = type;
+ Pressed += (_, __) => pressed?.Invoke();
+ }
+
+ public MessageNotificationItem(String message, MessageNotificationItemTypes type) : this(message, type, null)
+ {
+
+ }
+
+ public MessageNotificationItem(String message) : this(message, MessageNotificationItemTypes.Info)
+ {
+
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml
new file mode 100644
index 000000000..b049dc108
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml
@@ -0,0 +1,55 @@
+<UserControl x:Class="Tango.PPC.Common.Notifications.NotificationItems.MessageNotificationItemView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:local="clr-namespace:Tango.PPC.Common.Notifications.NotificationItems"
+ mc:Ignorable="d"
+ d:DesignHeight="60" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:MessageNotificationItem, IsDesignTimeCreatable=False}">
+ <ContentControl>
+ <ContentControl.Style>
+ <Style TargetType="ContentControl">
+ <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding MessageType}" Value="Info">
+ <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding MessageType}" Value="Success">
+ <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding MessageType}" Value="Warning">
+ <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding MessageType}" Value="Error">
+ <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ContentControl.Style>
+ <DockPanel>
+ <touch:TouchIcon Margin="15" DockPanel.Dock="Left" MaxHeight="50">
+ <touch:TouchIcon.Style>
+ <Style TargetType="touch:TouchIcon">
+ <Setter Property="Icon" Value="Information"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding MessageType}" Value="Info">
+ <Setter Property="Icon" Value="Information"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding MessageType}" Value="Success">
+ <Setter Property="Icon" Value="Check"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding MessageType}" Value="Warning">
+ <Setter Property="Icon" Value="Alert"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding MessageType}" Value="Error">
+ <Setter Property="Icon" Value="AlertOctagon"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </touch:TouchIcon.Style>
+ </touch:TouchIcon>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Text="{Binding Message}"></TextBlock>
+ </DockPanel>
+ </ContentControl>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml.cs
new file mode 100644
index 000000000..559d81347
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.PPC.Common.Notifications.NotificationItems
+{
+ /// <summary>
+ /// Interaction logic for MessageNotificationItemView.xaml
+ /// </summary>
+ public partial class MessageNotificationItemView : UserControl
+ {
+ public MessageNotificationItemView()
+ {
+ InitializeComponent();
+ }
+ }
+}