116 lines
5.3 KiB
XML
116 lines
5.3 KiB
XML
<UserControl x:Class="CtrEditor.ObjetosSim.ucHydTank"
|
|
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:CtrEditor.ObjetosSim"
|
|
xmlns:vm="clr-namespace:CtrEditor.ObjetosSim"
|
|
mc:Ignorable="d">
|
|
|
|
<!-- DataContext se establece desde el objeto padre, no aquí -->
|
|
<UserControl.DataContext>
|
|
<vm:osHydTank />
|
|
</UserControl.DataContext>
|
|
|
|
<Canvas RenderTransformOrigin="0,0">
|
|
<Canvas.RenderTransform>
|
|
<TransformGroup>
|
|
<ScaleTransform />
|
|
<SkewTransform />
|
|
<RotateTransform Angle="{Binding Angulo}" />
|
|
<TranslateTransform />
|
|
</TransformGroup>
|
|
</Canvas.RenderTransform>
|
|
|
|
<!-- Contenedor principal del tanque -->
|
|
<Grid Width="{Binding Tamano, Converter={StaticResource MeterToPixelConverter}}"
|
|
Height="{Binding Tamano, Converter={StaticResource MeterToPixelConverter}}">
|
|
|
|
<!-- Fondo del tanque (contenedor vacío) -->
|
|
<Rectangle x:Name="rectTankContainer"
|
|
Fill="LightGray"
|
|
Stroke="DarkGray"
|
|
StrokeThickness="2"
|
|
RadiusX="5"
|
|
RadiusY="5"/>
|
|
|
|
<!-- Nivel del líquido -->
|
|
<Rectangle x:Name="rectLevel"
|
|
Fill="{Binding LevelColor}"
|
|
Stroke="{Binding LevelBorderColor}"
|
|
StrokeThickness="1"
|
|
RadiusX="3"
|
|
RadiusY="3"
|
|
VerticalAlignment="Bottom"
|
|
Margin="4,4,4,4">
|
|
<Rectangle.Height>
|
|
<MultiBinding Converter="{StaticResource LevelToHeightMultiConverter}">
|
|
<Binding Path="FillPercentage"/>
|
|
<Binding Path="Tamano" Converter="{StaticResource MeterToPixelConverter}"/>
|
|
</MultiBinding>
|
|
</Rectangle.Height>
|
|
</Rectangle>
|
|
|
|
<!-- Líneas de nivel (marcas visuales) -->
|
|
<Canvas>
|
|
<!-- Línea de nivel máximo -->
|
|
<Line X1="0" Y1="8" X2="{Binding ActualWidth, ElementName=rectTankContainer}" Y2="8"
|
|
Stroke="Red" StrokeThickness="1" StrokeDashArray="2,2" Opacity="0.7"/>
|
|
|
|
<!-- Línea de nivel medio -->
|
|
<Line X1="0" Y1="{Binding MidLevelY}" X2="{Binding ActualWidth, ElementName=rectTankContainer}" Y2="{Binding MidLevelY}"
|
|
Stroke="Orange" StrokeThickness="1" StrokeDashArray="2,2" Opacity="0.5"/>
|
|
|
|
<!-- Línea de nivel mínimo -->
|
|
<Line X1="0" Y1="{Binding MinLevelY}" X2="{Binding ActualWidth, ElementName=rectTankContainer}" Y2="{Binding MinLevelY}"
|
|
Stroke="Red" StrokeThickness="1" StrokeDashArray="2,2" Opacity="0.7"/>
|
|
</Canvas>
|
|
|
|
<!-- Texto del porcentaje de llenado -->
|
|
<TextBlock Text="{Binding FillPercentage, StringFormat='{}{0:F0}%'}"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Foreground="White"
|
|
FontWeight="Bold"
|
|
FontSize="10"
|
|
Effect="{StaticResource DropShadowEffect}"/>
|
|
|
|
<!-- Indicador de tipo de tanque -->
|
|
<TextBlock Text="{Binding TankTypeIndicator}"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Top"
|
|
Foreground="Navy"
|
|
FontWeight="Bold"
|
|
FontSize="8"
|
|
Margin="2,0,0,0"/>
|
|
</Grid>
|
|
|
|
<!-- Panel de información -->
|
|
<Grid Canvas.Top="{Binding Tamano, Converter={StaticResource MeterToPixelConverter}, ConverterParameter=1.05}"
|
|
Width="{Binding Tamano, Converter={StaticResource MeterToPixelConverter}}">
|
|
<StackPanel Orientation="Horizontal"
|
|
HorizontalAlignment="Center"
|
|
Margin="0,2,0,0">
|
|
|
|
<!-- Presión actual -->
|
|
<TextBlock Text="{Binding CurrentPressureBar, StringFormat='{}{0:F1} bar'}"
|
|
Foreground="White" Background="Blue"
|
|
Padding="2" Margin="1" FontSize="8"/>
|
|
|
|
<!-- Nivel actual -->
|
|
<TextBlock Text="{Binding CurrentLevel, StringFormat='{}{0:F2} m'}"
|
|
Foreground="White" Background="Green"
|
|
Padding="2" Margin="1" FontSize="8"/>
|
|
|
|
<!-- Balance de flujo -->
|
|
<TextBlock Text="{Binding FlowBalanceLMin, StringFormat='{}{0:F1} L/min'}"
|
|
Foreground="White"
|
|
Background="{Binding FlowBalanceColor}"
|
|
Padding="2" Margin="1" FontSize="8"/>
|
|
|
|
</StackPanel>
|
|
</Grid>
|
|
</Canvas>
|
|
|
|
</UserControl>
|