aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-05-07 19:27:19 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-05-07 19:27:19 +0300
commit4635d671ecc0ac65372ebaaa7044230f44317c77 (patch)
tree6630bf6940552c46ae2d0f90632d2c5fff4d848a /Software/Visual_Studio/PPC/Modules
parent51f0a70bca80ccad4eae7c4abf0c09a6215540a9 (diff)
parent952b8d7f3c81d6943d0bbf665b74ff58ab8c1201 (diff)
downloadTango-4635d671ecc0ac65372ebaaa7044230f44317c77.tar.gz
Tango-4635d671ecc0ac65372ebaaa7044230f44317c77.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml54
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs7
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml2
3 files changed, 59 insertions, 4 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml
index 468ba228d..53102d8ec 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml
@@ -4,7 +4,7 @@
xmlns:converters="clr-namespace:Tango.PPC.Events.Converters"
xmlns:local="clr-namespace:Tango.PPC.Events.Resources">
- <!--Jobs Grid-->
+ <!--Events Grid-->
<Style x:Key="TangoEventsGrid" TargetType="{x:Type touch:LightTouchDataGrid}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGrid}}">
<Style.Resources>
@@ -85,6 +85,56 @@
</Style>
</Style.Resources>
</Style>
- <!--Jobs Grid-->
+
+ <Style x:Key="TangoEventsGridHistory" TargetType="{x:Type touch:LightTouchDataGrid}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGrid}}">
+ <Style.Resources>
+
+ <converters:MachineEventToViewConverter x:Key="MachineEventToViewConverter" />
+
+ <Style TargetType="{x:Type touch:LightTouchDataGridHeaderRow}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGridHeaderRow}}">
+ <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter>
+ <Setter Property="BorderThickness" Value="1"></Setter>
+ <Setter Property="BorderBrush" Value="{StaticResource TangoLowAccentBrush}"></Setter>
+ <Setter Property="Height" Value="68"></Setter>
+ <Setter Property="Margin" Value="5 0 5 5"></Setter>
+ <Setter Property="CornerRadius" Value="5"></Setter>
+ <Setter Property="Effect">
+ <Setter.Value>
+ <DropShadowEffect BlurRadius="5" ShadowDepth="1" Color="Silver" />
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style TargetType="{x:Type touch:LightTouchDataGridRow}">
+ <Setter Property="Background" Value="{StaticResource TangoPrimaryBackgroundBrush}"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter>
+ <Setter Property="BorderThickness" Value="1"></Setter>
+ <Setter Property="BorderBrush" Value="{StaticResource TangoLightBorderBrush}"></Setter>
+ <Setter Property="Padding" Value="5"></Setter>
+ <Setter Property="CornerRadius" Value="5"></Setter>
+ <Setter Property="Margin" Value="5 4"></Setter>
+ <Setter Property="Height" Value="Auto"></Setter>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type touch:LightTouchDataGridRow}">
+ <Border DockPanel.Dock="Top" Background="{TemplateBinding Background}"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}"
+ CornerRadius="{TemplateBinding CornerRadius}"
+ Padding="{TemplateBinding Padding}">
+ <ContentPresenter Height="78" DockPanel.Dock="Top" Content="{TemplateBinding Content}" />
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style TargetType="{x:Type touch:LightTouchDataGridCell}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGridCell}}">
+
+ </Style>
+ </Style.Resources>
+ </Style>
+ <!--Events Grid-->
</ResourceDictionary> \ 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 dcf6afb97..997ea70d5 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
@@ -97,7 +97,7 @@ namespace Tango.PPC.Events.ViewModels
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();
+ HistoryEvents = (await db.MachinesEvents.Where(x => x.MachineGuid == MachineProvider.Machine.Guid && x.DateTime > last_week).Take(100).Include(x => x.EventType).Where(x => (EventTypeNotificationTimes)x.EventType.EventNotificationTime != EventTypeNotificationTimes.None).ToListAsync()).OrderByDescending(x => x.DateTime).ToObservableCollection();
}
MachineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged;
@@ -177,6 +177,11 @@ namespace Tango.PPC.Events.ViewModels
_notifications.Remove(item);
NotificationProvider.PopNotification(item.Value);
}
+
+ if (HistoryEvents.Count > 100)
+ {
+ HistoryEvents.Remove(HistoryEvents.Last());
+ }
}
});
}
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 af42a5576..f263e4b7b 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
@@ -135,7 +135,7 @@
</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 x:Name="gridEventsHistory" SelectionChanged="gridEventsHistory_SelectionChanged" RenderOptions.EdgeMode="Unspecified" SelectionMode="Single" EnableDragAndDrop="False" Style="{StaticResource TangoEventsGridHistory}" 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>