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
|
<UserControl x:Class="Tango.FSE.UI.Tiles.MidTankLevels.MidTankLevelsTileView"
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:local="clr-namespace:Tango.FSE.UI.Tiles.MidTankLevels"
xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:resolution="clr-namespace:Tango.FSE.Common.Resolution;assembly=Tango.FSE.Common"
xmlns:localConverters="clr-namespace:Tango.FSE.UI.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:MidTankLevelsTile, IsDesignTimeCreatable=False}">
<UserControl.Resources>
<localConverters:StringToFirstLetterConverter x:Key="StringToFirstLetterConverter" />
<localConverters:MidTankLevelToElementHeightConverter x:Key="MidTankLevelToElementHeightConverter" />
<localConverters:LiquidTypeToBrushConverter x:Key="LiquidTypeToBrushConverter" />
<DataTemplate x:Key="LiquidBox">
<DockPanel>
<TextBlock DockPanel.Dock="Top" Text="{Binding IDSPack.LiquidType.ShortName}" HorizontalAlignment="Center"></TextBlock>
<Grid MaxWidth="50" Margin="5 0" ToolTip="{Binding IDSPack.LiquidType.Name}" Background="Transparent">
<material:PackIcon Kind="MapMarker" Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 10" Foreground ="{Binding Path=IDSPack.LiquidType, Converter={StaticResource LiquidTypeToBrushConverter}}">
<material:PackIcon.Style>
<Style TargetType="material:PackIcon">
<Setter Property="Visibility" Value="Hidden"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding IsLow}" Value="True">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding IsEmpty}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Name="blinkDrop">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever">
<DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" />
<DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<RemoveStoryboard BeginStoryboardName="blinkDrop" />
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</material:PackIcon.Style>
</material:PackIcon>
<Border BorderThickness="1" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" BorderBrush="{StaticResource FSE_BorderBrush}" CornerRadius="3" ClipToBounds="True" x:Name="pathBorder">
<Canvas ClipToBounds="True" Margin="1 1 1 1">
<Path Panel.ZIndex="1" VerticalAlignment="Bottom" ClipToBounds="True" MinHeight="2" Data="M0,0 C2,0 8.9,-1.1705073 11.3,-4.6 14.5,-7.7 15.5,-8 18.7,-10.8 21.7,-13.16 23.3,-14.5 28,-15.6 28,-13.7 28,80 28,100 L0,100 z" Height="135" Width="38" Stretch="Fill"
Canvas.Left="0" Fill="{Binding Path=IDSPack.LiquidType, Converter={StaticResource LiquidTypeToBrushConverter}}" Margin="0 -14 0 0" >
<Path.Style>
<Style>
<Setter Property="Canvas.Top" >
<Setter.Value>
<MultiBinding Converter="{StaticResource MidTankLevelToElementHeightConverter}">
<Binding ElementName="pathBorder" Path="ActualHeight" />
<Binding Path="Level" />
<Binding Path="Max" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</Path.Style>
</Path>
</Canvas>
</Border>
</Grid>
</DockPanel>
</DataTemplate>
</UserControl.Resources>
<Grid Opacity="0.6">
<!--<Viewbox HorizontalAlignment="Left">-->
<DockPanel>
<Viewbox>
<ItemsControl VerticalAlignment="Top" Margin="0 20 0 20" Height="140" Width="350" ItemsSource="{Binding MidTankLevels}" ItemTemplate="{StaticResource LiquidBox}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" IsItemsHost="True"></UniformGrid>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Viewbox>
<Border VerticalAlignment="Top" MaxHeight="110" CornerRadius="5" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" resolution:ResolutionHelper.HighResolutionMargin="10 33 0 0" resolution:ResolutionHelper.LowResolutionMargin="10 10 0 0">
<ItemsControl VerticalAlignment="Top" ItemsSource="{Binding MidTankLevels}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical" IsItemsHost="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel Margin="5">
<Ellipse Width="10" Height="10">
<Ellipse.Fill>
<SolidColorBrush Color="{Binding IDSPack.LiquidType.LiquidTypeColor}" />
</Ellipse.Fill>
</Ellipse>
<TextBlock FontSize="{StaticResource FSE_SmallerFontSize}" Margin="5 0 0 0" Text="{Binding Level,StringFormat=0.00 L}"></TextBlock>
</DockPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>
</DockPanel>
<!--</Viewbox>-->
</Grid>
</UserControl>
|