aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-01-08 16:19:50 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-01-08 16:19:50 +0200
commit68be90b29a5ea3776481ee8e2fde33083c11c670 (patch)
treeb12900aae40c50df19c67be1a5cba630ad13e334 /Software/Visual_Studio/PPC/Modules/Tango.PPC.Events
parent65e6368cbe7eeddd02bbd43ae5159ab4b762165f (diff)
downloadTango-68be90b29a5ea3776481ee8e2fde33083c11c670.tar.gz
Tango-68be90b29a5ea3776481ee8e2fde33083c11c670.zip
Implemented PPC events history.
Fixed PPC storage inserted navigation.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Events')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Enumerations/EventsSource.cs14
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj3
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs115
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml249
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml.cs18
5 files changed, 289 insertions, 110 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Enumerations/EventsSource.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Enumerations/EventsSource.cs
new file mode 100644
index 000000000..e158ff112
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Enumerations/EventsSource.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Events.Enumerations
+{
+ public enum EventsSource
+ {
+ CURRENT,
+ HISTORY
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj
index 6ef477f5d..aea663b1c 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj
@@ -87,6 +87,7 @@
<Link>GlobalVersionInfo.cs</Link>
</Compile>
<Compile Include="Converters\MachineEventToViewConverter.cs" />
+ <Compile Include="Enumerations\EventsSource.cs" />
<Compile Include="EventsModule.cs" />
<Compile Include="EventsViews\GeneralView.xaml.cs">
<DependentUpon>GeneralView.xaml</DependentUpon>
@@ -159,7 +160,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
index dd8b8041d..a00ff869e 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
@@ -4,11 +4,14 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.BL;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
using Tango.PPC.Common;
using Tango.PPC.Common.Notifications;
using Tango.PPC.Common.Notifications.NotificationItems;
+using Tango.PPC.Events.Enumerations;
+using System.Data.Entity;
namespace Tango.PPC.Events.ViewModels
{
@@ -20,6 +23,13 @@ namespace Tango.PPC.Events.ViewModels
{
private Dictionary<EventTypes, NotificationItem> _notifications;
+ private EventsSource _selectedEventsSource;
+ public EventsSource SelectedEventsSource
+ {
+ get { return _selectedEventsSource; }
+ set { _selectedEventsSource = value; RaisePropertyChangedAuto(); }
+ }
+
private ObservableCollection<MachinesEvent> _currentEvents;
/// <summary>
/// Gets or sets the current events.
@@ -31,6 +41,9 @@ namespace Tango.PPC.Events.ViewModels
}
private MachinesEvent _selectedEvent;
+ /// <summary>
+ /// Gets or sets the selected event.
+ /// </summary>
public MachinesEvent SelectedEvent
{
get { return _selectedEvent; }
@@ -38,6 +51,26 @@ namespace Tango.PPC.Events.ViewModels
}
+ private ObservableCollection<MachinesEvent> _historyEvents;
+ /// <summary>
+ /// Gets or sets the history events.
+ /// </summary>
+ public ObservableCollection<MachinesEvent> HistoryEvents
+ {
+ get { return _historyEvents; }
+ set { _historyEvents = value; RaisePropertyChangedAuto(); }
+ }
+
+ private MachinesEvent _selectedHistoryEvent;
+ /// <summary>
+ /// Gets or sets the selected event.
+ /// </summary>
+ public MachinesEvent SelectedHistoryEvent
+ {
+ get { return _selectedHistoryEvent; }
+ set { _selectedHistoryEvent = value; RaisePropertyChangedAuto(); }
+ }
+
/// <summary>
/// Initializes a new instance of the <see cref="MainViewVM"/> class.
/// </summary>
@@ -56,45 +89,55 @@ namespace Tango.PPC.Events.ViewModels
EventLogger.EventResolved += EventLogger_EventResolved;
}
+ public override async void OnApplicationReady()
+ {
+ base.OnApplicationReady();
+
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ var last_week = DateTime.UtcNow.AddDays(-7);
+ HistoryEvents = (await db.MachinesEvents.Where(x => x.MachineGuid == MachineProvider.Machine.Guid && x.DateTime > last_week).Include(x => x.EventType).Where(x => (EventTypeNotificationTimes)x.EventType.EventNotificationTime != EventTypeNotificationTimes.None).ToListAsync()).OrderByDescending(x => x.DateTime).ToObservableCollection();
+ }
+ }
+
private void EventLogger_EventReceived(object sender, MachinesEvent ev)
{
InvokeUI(() =>
{
- if (ev.Group != EventTypeGroups.Transport)
+ if (ev.NotificationTime != EventTypeNotificationTimes.None)
{
CurrentEvents.Insert(0, ev);
- if (ev.Group != EventTypeGroups.Application && ev.Group != EventTypeGroups.Transport)
+ var notificationItem = new MessageNotificationItem();
+ notificationItem.CanClose = false;
+ notificationItem.Message = ev.EventType.Description;
+ notificationItem.ExpandedMessage = ev.Description;
+ notificationItem.Pressed += async (_, __) =>
{
- var notificationItem = new MessageNotificationItem();
- notificationItem.CanClose = false;
- notificationItem.Message = ev.EventType.Description;
- notificationItem.ExpandedMessage = ev.Description;
- notificationItem.Pressed += async (_, __) =>
- {
- SelectedEvent = ev;
- await NavigationManager.NavigateTo<EventsModule>();
- };
-
- switch (ev.Category)
- {
- case EventTypeCategories.Info:
- notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Info;
- break;
- case EventTypeCategories.Warning:
- notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Warning;
- break;
- case EventTypeCategories.Error:
- notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error;
- break;
- case EventTypeCategories.Critical:
- notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Critical;
- break;
- }
+ SelectedEventsSource = EventsSource.CURRENT;
+ SelectedEvent = ev;
+ await NavigationManager.NavigateTo<EventsModule>();
+ };
- NotificationProvider.PushNotification(notificationItem);
- _notifications.Add(ev.EventType.Type, notificationItem);
+ switch (ev.Category)
+ {
+ case EventTypeCategories.Info:
+ notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Info;
+ break;
+ case EventTypeCategories.Warning:
+ notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Warning;
+ break;
+ case EventTypeCategories.Error:
+ notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error;
+ break;
+ case EventTypeCategories.Critical:
+ notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Critical;
+ break;
}
+
+ NotificationProvider.PushNotification(notificationItem);
+ _notifications.Add(ev.EventType.Type, notificationItem);
+
}
});
}
@@ -103,18 +146,16 @@ namespace Tango.PPC.Events.ViewModels
{
InvokeUI(() =>
{
- if (ev.Group != EventTypeGroups.Transport)
+ if (ev.NotificationTime != EventTypeNotificationTimes.None)
{
CurrentEvents.Remove(ev);
+ HistoryEvents.Insert(0, ev);
- if (ev.Group != EventTypeGroups.Application && ev.Group != EventTypeGroups.Transport)
+ if (_notifications.ContainsKey(ev.EventType.Type))
{
- if (_notifications.ContainsKey(ev.EventType.Type))
- {
- var notification = _notifications[ev.EventType.Type];
- _notifications.Remove(ev.EventType.Type);
- NotificationProvider.PopNotification(notification);
- }
+ var notification = _notifications[ev.EventType.Type];
+ _notifications.Remove(ev.EventType.Type);
+ NotificationProvider.PopNotification(notification);
}
}
});
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml
index 2a48d71d6..3477a5349 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:Tango.PPC.Events.ViewModels"
xmlns:global="clr-namespace:Tango.PPC.Events"
+ xmlns:enumerations="clr-namespace:Tango.PPC.Events.Enumerations"
xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
xmlns:local="clr-namespace:Tango.PPC.Events.Views"
mc:Ignorable="d"
@@ -33,79 +34,183 @@
</Border>
<Grid Grid.Row="1">
- <touch:LightTouchDataGrid SelectionChanged="dataGridEvent_SelectionChanged" RenderOptions.EdgeMode="Unspecified" SelectionMode="Single" EnableDragAndDrop="False" Style="{StaticResource TangoEventsGrid}" x:Name="dataGridEvent" ItemsSource="{Binding CurrentEvents}" SelectedItem="{Binding SelectedEvent,Mode=TwoWay}" ItemSelectedCommand="{Binding EventSelectedCommand}" Margin="10">
- <touch:LightTouchDataGrid.Columns>
- <touch:LightTouchDataGridColumn Width="120" Header="Severity" HorizontalContentAlignment="Center" SortMember="Category">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <touch:TouchIcon Width="32" Height="32" IsHitTestVisible="False">
- <touch:TouchIcon.Style>
- <Style TargetType="touch:TouchIcon">
- <Setter Property="Icon" Value="CheckCircleOutline"/>
- <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"/>
- <Style.Triggers>
- <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Warning">
- <Setter Property="Icon" Value="AlertCircleOutline"/>
- <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Error">
- <Setter Property="Icon" Value="AlertCircleOutline"/>
- <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Critical">
- <Setter Property="Icon" Value="Alert"/>
- <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </touch:TouchIcon.Style>
- </touch:TouchIcon>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="1*" Header="Title" SortMember="Name" HorizontalContentAlignment="Left">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <TextBlock IsHitTestVisible="False" Text="{Binding Name,Mode=OneWay}"></TextBlock>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="100" Header="# Error Code." SortMember="Code" HorizontalContentAlignment="Center">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <TextBlock IsHitTestVisible="False">
+ <DockPanel>
+
+ <touch:TouchNavigationLinks ItemsSource="{Binding Source={x:Type enumerations:EventsSource},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding SelectedEventsSource}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" DockPanel.Dock="Top" VerticalAlignment="Bottom" Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}"></touch:TouchNavigationLinks>
+
+ <Grid>
+ <Grid>
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Setter Property="Visibility" Value="Hidden"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding SelectedEventsSource}" Value="CURRENT">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Grid.Style>
+ <touch:LightTouchDataGrid SelectionChanged="dataGridEvent_SelectionChanged" RenderOptions.EdgeMode="Unspecified" SelectionMode="Single" EnableDragAndDrop="False" Style="{StaticResource TangoEventsGrid}" x:Name="dataGridEvent" ItemsSource="{Binding CurrentEvents}" SelectedItem="{Binding SelectedEvent,Mode=TwoWay}" Margin="10">
+ <touch:LightTouchDataGrid.Columns>
+ <touch:LightTouchDataGridColumn Width="120" Header="Severity" HorizontalContentAlignment="Center" SortMember="Category">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <touch:TouchIcon Width="32" Height="32" IsHitTestVisible="False">
+ <touch:TouchIcon.Style>
+ <Style TargetType="touch:TouchIcon">
+ <Setter Property="Icon" Value="CheckCircleOutline"/>
+ <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"/>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Warning">
+ <Setter Property="Icon" Value="AlertCircleOutline"/>
+ <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"/>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Error">
+ <Setter Property="Icon" Value="AlertCircleOutline"/>
+ <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"/>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Critical">
+ <Setter Property="Icon" Value="Alert"/>
+ <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </touch:TouchIcon.Style>
+ </touch:TouchIcon>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="1*" Header="Title" SortMember="Name" HorizontalContentAlignment="Left">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding Name,Mode=OneWay}"></TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="100" Header="# Error Code." SortMember="Code" HorizontalContentAlignment="Center">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False">
+ <Run>#</Run><Run Text="{Binding Code,Mode=OneWay}"></Run>
+ </TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="200" Header="Date &amp; Time" SortMember="DateTime">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding DateTime,Converter={StaticResource DateTimeUTCToStringConverter},ConverterParameter=g}"></TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="50" HorizontalContentAlignment="Center">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <touch:TouchIcon Width="24" Height="24">
+ <touch:TouchIcon.Style>
+ <Style TargetType="touch:TouchIcon">
+ <Setter Property="Icon" Value="ChevronRight"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=touch:LightTouchDataGridRow},Path=IsSelected}" Value="True">
+ <Setter Property="Icon" Value="ChevronDown"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </touch:TouchIcon.Style>
+ </touch:TouchIcon>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ </touch:LightTouchDataGrid.Columns>
+ </touch:LightTouchDataGrid>
+ </Grid>
+ <Grid>
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Setter Property="Visibility" Value="Hidden"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding SelectedEventsSource}" Value="HISTORY">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Grid.Style>
+ <touch:LightTouchDataGrid x:Name="gridEventsHistory" SelectionChanged="gridEventsHistory_SelectionChanged" RenderOptions.EdgeMode="Unspecified" SelectionMode="Single" EnableDragAndDrop="False" Style="{StaticResource TangoEventsGrid}" ItemsSource="{Binding HistoryEvents}" SelectedItem="{Binding SelectedHistoryEvent,Mode=TwoWay}" Margin="10">
+ <touch:LightTouchDataGrid.Columns>
+ <touch:LightTouchDataGridColumn Width="120" Header="Severity" HorizontalContentAlignment="Center" SortMember="Category">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <touch:TouchIcon Width="32" Height="32" IsHitTestVisible="False">
+ <touch:TouchIcon.Style>
+ <Style TargetType="touch:TouchIcon">
+ <Setter Property="Icon" Value="CheckCircleOutline"/>
+ <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"/>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Warning">
+ <Setter Property="Icon" Value="AlertCircleOutline"/>
+ <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"/>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Error">
+ <Setter Property="Icon" Value="AlertCircleOutline"/>
+ <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"/>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Critical">
+ <Setter Property="Icon" Value="Alert"/>
+ <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </touch:TouchIcon.Style>
+ </touch:TouchIcon>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="1*" Header="Title" SortMember="Name" HorizontalContentAlignment="Left">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding Name,Mode=OneWay}"></TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="100" Header="# Error Code." SortMember="Code" HorizontalContentAlignment="Center">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False">
<Run>#</Run><Run Text="{Binding Code,Mode=OneWay}"></Run>
- </TextBlock>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="200" Header="Date &amp; Time" SortMember="DateTime">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <TextBlock IsHitTestVisible="False" Text="{Binding DateTime,Converter={StaticResource DateTimeUTCToStringConverter},ConverterParameter=g}"></TextBlock>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="50" HorizontalContentAlignment="Center">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <touch:TouchIcon Width="24" Height="24">
- <touch:TouchIcon.Style>
- <Style TargetType="touch:TouchIcon">
- <Setter Property="Icon" Value="ChevronRight"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=touch:LightTouchDataGridRow},Path=IsSelected}" Value="True">
- <Setter Property="Icon" Value="ChevronDown"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </touch:TouchIcon.Style>
- </touch:TouchIcon>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- </touch:LightTouchDataGrid.Columns>
- </touch:LightTouchDataGrid>
+ </TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="200" Header="Date &amp; Time" SortMember="DateTime">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding DateTime,Converter={StaticResource DateTimeUTCToStringConverter},ConverterParameter=g}"></TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="50" HorizontalContentAlignment="Center">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <touch:TouchIcon Width="24" Height="24">
+ <touch:TouchIcon.Style>
+ <Style TargetType="touch:TouchIcon">
+ <Setter Property="Icon" Value="ChevronRight"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=touch:LightTouchDataGridRow},Path=IsSelected}" Value="True">
+ <Setter Property="Icon" Value="ChevronDown"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </touch:TouchIcon.Style>
+ </touch:TouchIcon>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ </touch:LightTouchDataGrid.Columns>
+ </touch:LightTouchDataGrid>
+ </Grid>
+ </Grid>
+ </DockPanel>
</Grid>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml.cs
index 248b1eecb..aef2f5c5f 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml.cs
@@ -42,5 +42,23 @@ namespace Tango.PPC.Events.Views
});
});
}
+
+ private void gridEventsHistory_SelectionChanged(object sender, EventArgs e)
+ {
+ Task.Delay(100).ContinueWith((x) =>
+ {
+ this.BeginInvoke(() =>
+ {
+ gridEventsHistory.LayoutRows(false);
+
+ var selected_row = gridEventsHistory.GetRows().FirstOrDefault(y => y.IsSelected);
+
+ if (selected_row != null)
+ {
+ gridEventsHistory.ScrollViewer.ScrollToElement(selected_row);
+ }
+ });
+ });
+ }
}
}