1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
<UserControl x:Class="Tango.FSE.UI.Views.EventsView"
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:global="clr-namespace:Tango.FSE.UI"
xmlns:vm="clr-namespace:Tango.FSE.UI.ViewModels"
xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common"
xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:resolution="clr-namespace:Tango.FSE.Common.Resolution;assembly=Tango.FSE.Common"
xmlns:auth="clr-namespace:Tango.FSE.Common.Authorization;assembly=Tango.FSE.Common"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:local="clr-namespace:Tango.FSE.UI.Views"
mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:EventsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.EventsViewVM}" Background="{StaticResource FSE_PrimaryBackgroundBrush}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}">
<Grid Margin="20">
<Image Source="/Images/events_back.png" HorizontalAlignment="Right" VerticalAlignment="Top" Opacity="0.05" Stretch="None" />
<DockPanel>
<Grid DockPanel.Dock="Top" Height="100">
<DockPanel HorizontalAlignment="Left">
<Image Source="/Images/menu/events.png" Stretch="None" />
<StackPanel Margin="10 15 0 0">
<TextBlock FontSize="{StaticResource FSE_ModuleHeaderFontSize}" Foreground="{StaticResource FSE_PrimaryAccentBrush}" >Machine Events</TextBlock>
<TextBlock>Below you can find the list of active and resolved machine events.</TextBlock>
</StackPanel>
</DockPanel>
</Grid>
<Grid Margin="70 40 0 0">
<ScrollViewer x:Name="scrollEvents" FocusVisualStyle="{x:Null}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<StackPanel Width="700" HorizontalAlignment="Left">
<DockPanel>
<material:PackIcon Kind="NotificationsActive" Width="24" Height="24" />
<TextBlock VerticalAlignment="Center" Margin="5 0 0 0" Foreground="{StaticResource FSE_PrimaryAccentBrush}" FontSize="{StaticResource FSE_LargeFontSize}" FontWeight="SemiBold">Active Events</TextBlock>
</DockPanel>
<DockPanel Opacity="0.5" Height="150" Margin="20 20 0 0" TextElement.Foreground="{StaticResource FSE_GrayBrush}" Visibility="{Binding EventsProvider.ActiveEvents.Count,Converter={StaticResource IsEqualToVisibilityConverter},ConverterParameter=0}">
<material:PackIcon VerticalAlignment="Top" Kind="InfoOutline" Width="32" Height="32" />
<TextBlock Margin="10 6 0 0" VerticalAlignment="Top" FontSize="{StaticResource FSE_LargeFontSize}">no active events</TextBlock>
</DockPanel>
<ListBox x:Name="listBoxActiveEvents" ItemContainerStyle="{StaticResource FSE_BlankListBoxItem}" Background="Transparent" HorizontalContentAlignment="Stretch" Margin="15 5 0 0" ItemsSource="{Binding EventsProvider.ActiveEvents}" SelectedItem="{Binding SelectedEvent}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0 10">
<DockPanel>
<material:PackIcon Width="24" Height="24" Style="{StaticResource FSE_LogIcon}" />
<StackPanel Margin="10 0 0 0">
<DockPanel VerticalAlignment="Center">
<TextBlock FontSize="{StaticResource FSE_SmallFontSize}" DockPanel.Dock="Right" Text="{Binding DateTime,Converter={StaticResource DateTimeUtcToLocalDateTime},StringFormat='HH:mm:ss'}" ToolTip="{Binding DateTime,Converter={StaticResource DateTimeUtcHumanizeConverter}}"></TextBlock>
<TextBlock Text="{Binding EventType,Converter={StaticResource EventTypeTitleConverter}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
<Setter Property="Foreground" Value="{StaticResource FSE_PrimaryAccentBrush}"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DockPanel>
<Rectangle Margin="0 5 0 5" DockPanel.Dock="Top" VerticalAlignment="Bottom" StrokeThickness="1">
<Rectangle.Stroke>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
<GradientStop Offset="0" Color="{StaticResource FSE_BorderColor}" />
<GradientStop Offset="1" Color="Transparent" />
</LinearGradientBrush>
</Rectangle.Stroke>
</Rectangle>
<DockPanel TextElement.FontSize="{StaticResource FSE_SmallFontSize}" TextElement.Foreground="{StaticResource FSE_GrayBrush}">
<TextBlock DockPanel.Dock="Right"><Run>#</Run><Run Text="{Binding EventType.Code}"></Run></TextBlock>
<TextBlock Text="{Binding EventType,Converter={StaticResource EventTypeTechnicalDescriptionConverter}}" Margin="0 0 10 0" TextWrapping="Wrap"></TextBlock>
</DockPanel>
<StackPanel Margin="0 5 0 0" TextElement.FontSize="{StaticResource FSE_SmallerFontSize}" TextElement.Foreground="{StaticResource FSE_GrayBrush}">
<!--<TextBlock Text="{Binding EventType.Name}"></TextBlock>-->
<TextBlock TextWrapping="Wrap" Margin="0 2 0 0" Text="{Binding Description}"></TextBlock>
</StackPanel>
</StackPanel>
</DockPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<DockPanel Margin="0 60 0 0">
<material:PackIcon Kind="History" Width="24" Height="24" />
<DockPanel VerticalAlignment="Center" Margin="5 0 0 0" >
<controls:ToggleIconButton Cursor="Hand" x:Name="chkHistory" DockPanel.Dock="Right" ToolTip="Show/Hide resolved" UncheckedIcon="ChevronDown" CheckedIcon="ChevronUp" />
<TextBlock VerticalAlignment="Center" Foreground="{StaticResource FSE_PrimaryAccentBrush}" FontSize="{StaticResource FSE_LargeFontSize}" FontWeight="SemiBold">Resolved Events</TextBlock>
</DockPanel>
</DockPanel>
<StackPanel Visibility="{Binding ElementName=chkHistory,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}">
<DockPanel Opacity="0.5" Margin="20 20 0 0" TextElement.Foreground="{StaticResource FSE_GrayBrush}" Visibility="{Binding EventsProvider.EventsHistory.Count,Converter={StaticResource IsEqualToVisibilityConverter},ConverterParameter=0}">
<material:PackIcon VerticalAlignment="Top" Kind="InfoOutline" Width="32" Height="32" />
<TextBlock Margin="10 6 0 0" VerticalAlignment="Top" FontSize="{StaticResource FSE_LargeFontSize}">no resolved events</TextBlock>
</DockPanel>
<ItemsControl Opacity="0.6" Background="Transparent" HorizontalContentAlignment="Stretch" Margin="15 5 0 0" ItemsSource="{Binding EventsProvider.EventsHistory}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0 10">
<DockPanel>
<material:PackIcon Width="24" Height="24" Style="{StaticResource FSE_LogIcon}" />
<StackPanel Margin="10 0 0 0">
<DockPanel VerticalAlignment="Center">
<TextBlock FontSize="{StaticResource FSE_SmallFontSize}" DockPanel.Dock="Right" Text="{Binding DateTime,Converter={StaticResource DateTimeUtcToLocalDateTime},StringFormat='HH:mm:ss'}" ToolTip="{Binding DateTime,Converter={StaticResource DateTimeUtcHumanizeConverter}}"></TextBlock>
<TextBlock Text="{Binding EventType,Converter={StaticResource EventTypeTitleConverter}}"></TextBlock>
</DockPanel>
<Rectangle Margin="0 5 0 5" DockPanel.Dock="Top" VerticalAlignment="Bottom" StrokeThickness="1">
<Rectangle.Stroke>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
<GradientStop Offset="0" Color="{StaticResource FSE_BorderColor}" />
<GradientStop Offset="1" Color="Transparent" />
</LinearGradientBrush>
</Rectangle.Stroke>
</Rectangle>
<DockPanel TextElement.FontSize="{StaticResource FSE_SmallFontSize}" TextElement.Foreground="{StaticResource FSE_GrayBrush}">
<TextBlock DockPanel.Dock="Right"><Run>#</Run><Run Text="{Binding EventType.Code}"></Run></TextBlock>
<TextBlock Text="{Binding EventType,Converter={StaticResource EventTypeTechnicalDescriptionConverter}}" Margin="0 0 10 0" TextWrapping="Wrap"></TextBlock>
</DockPanel>
<StackPanel Margin="0 5 0 0" TextElement.FontSize="{StaticResource FSE_SmallerFontSize}" TextElement.Foreground="{StaticResource FSE_GrayBrush}">
<!--<TextBlock Text="{Binding EventType.Name}"></TextBlock>-->
<TextBlock TextWrapping="Wrap" Margin="0 2 0 0" Text="{Binding Description}"></TextBlock>
<TextBlock Foreground="{StaticResource FSE_GreenBrush}" TextWrapping="Wrap" Margin="0 2 0 0" Visibility="{Binding EventType.Persistent,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
<Run>Resolved after</Run>
<Run Text="{Binding Duration,Converter={StaticResource TimeSpanHumanizeConverter},Mode=OneWay}"></Run>
</TextBlock>
</StackPanel>
</StackPanel>
</DockPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</DockPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Left" FontSize="{StaticResource FSE_ModuleHeaderFontSize}">status</TextBlock>
<DockPanel Margin="0 10 0 0">
<Grid>
<Grid Visibility="{Binding EventsProvider.HasActiveEvents,Converter={StaticResource BooleanToVisibilityConverter}}">
<lvc:PieChart resolution:ResolutionHelper.Mode="High" DisableAnimations="True" LegendLocation="None" Hoverable="False" DataTooltip="{x:Null}" Width="320" Height="300" InnerRadius="80">
<lvc:PieChart.Series>
<lvc:PieSeries Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Stroke="{StaticResource FSE_PrimaryBackgroundBrush}" Fill="{StaticResource FSE_WarningBrush}" FontSize="16" Title="Warning" Values="{Binding WarningEvents,Converter={StaticResource DoubleToChartValuesConverter}}" DataLabels="False"
/>
<lvc:PieSeries Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Stroke="{StaticResource FSE_PrimaryBackgroundBrush}" Fill="{StaticResource FSE_ErrorBrush}" FontSize="16" Title="Error" Values="{Binding ErrorEvents,Converter={StaticResource DoubleToChartValuesConverter}}" DataLabels="False"
/>
<lvc:PieSeries Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Stroke="{StaticResource FSE_PrimaryBackgroundBrush}" Fill="{StaticResource FSE_CriticalBrush}" FontSize="16" Title="Critical" Values="{Binding CriticalEvents,Converter={StaticResource DoubleToChartValuesConverter}}" DataLabels="False"
/>
</lvc:PieChart.Series>
</lvc:PieChart>
</Grid>
<Grid Visibility="{Binding EventsProvider.HasActiveEvents,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
<lvc:PieChart resolution:ResolutionHelper.Mode="High" DisableAnimations="True" LegendLocation="None" Hoverable="False" DataTooltip="{x:Null}" Width="320" Height="300" InnerRadius="80">
<lvc:PieChart.Series>
<lvc:PieSeries Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Stroke="{StaticResource FSE_PrimaryBackgroundBrush}" Fill="{StaticResource FSE_GrayBrush}" FontSize="16" Title="Warning" Values="1" DataLabels="False"
/>
<lvc:PieSeries Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Stroke="{StaticResource FSE_PrimaryBackgroundBrush}" Fill="{StaticResource FSE_GrayBrush}" FontSize="16" Title="Error" Values="1" DataLabels="False"
/>
<lvc:PieSeries Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Stroke="{StaticResource FSE_PrimaryBackgroundBrush}" Fill="{StaticResource FSE_GrayBrush}" FontSize="16" Title="Critical" Values="1" DataLabels="False"
/>
</lvc:PieChart.Series>
</lvc:PieChart>
</Grid>
</Grid>
<StackPanel Margin="10 0 0 0">
<TextBlock>active events summary:</TextBlock>
<StackPanel TextElement.FontSize="{StaticResource FSE_SmallFontSize}" Margin="0 20 0 0">
<DockPanel Margin="0 5">
<material:PackIcon Kind="BellAlert" Foreground="{StaticResource FSE_CriticalBrush}" />
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center">
<Run Text="{Binding CriticalEvents}"></Run>
<Run>critical</Run>
</TextBlock>
</DockPanel>
<DockPanel Margin="0 5">
<material:PackIcon Kind="Alert" Foreground="{StaticResource FSE_ErrorBrush}" />
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center">
<Run Text="{Binding ErrorEvents}"></Run>
<Run>errors</Run>
</TextBlock>
</DockPanel>
<DockPanel Margin="0 5">
<material:PackIcon Kind="Alert" Foreground="{StaticResource FSE_WarningBrush}" />
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center">
<Run Text="{Binding WarningEvents}"></Run>
<Run>warnings</Run>
</TextBlock>
</DockPanel>
</StackPanel>
<TextBlock Margin="0 40 0 0">job execution status:</TextBlock>
<DockPanel Margin="0 20 0 0">
<material:PackIcon>
<material:PackIcon.Style>
<Style TargetType="material:PackIcon">
<Setter Property="Foreground" Value="{StaticResource FSE_ErrorBrush}"></Setter>
<Setter Property="Kind" Value="Alert"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding CanExecuteJob}" Value="True">
<Setter Property="Foreground" Value="{StaticResource FSE_SuccessBrush}"></Setter>
<Setter Property="Kind" Value="Check"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</material:PackIcon.Style>
</material:PackIcon>
<TextBlock Margin="5 -2 0 0" VerticalAlignment="Center" FontSize="{StaticResource FSE_SmallFontSize}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="cannot execute job"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding CanExecuteJob}" Value="True">
<Setter Property="Text" Value="job execution is enabled"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DockPanel>
<Button Margin="0 20 0 0" auth:AuthorizationHelper.Mode="Collapsed" auth:AuthorizationHelper.Permission="FSE_EmulateMachineEvents" Command="{Binding EmulateMachineEventCommand}" ToolTip="Emulate a machine hardware event (for testing purpose only)" Style="{StaticResource FSE_Button_Polygon}" Width="170" IsEnabled="{Binding MachineProvider.IsPPCAvailable}">Emulate Machine Event</Button>
</StackPanel>
</DockPanel>
</StackPanel>
</Grid>
</Grid>
</UserControl>
|