agrobot_base/AgroBase/OperationControl/Controls/Pulverizador/PulverizadorIndicator.xaml

249 lines
13 KiB
Plaintext
Raw Normal View History

<UserControl x:Class="OperationControl.Controls.PulverizadorIndicator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
2026-03-12 01:00:21 +00:00
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:OperationControl.Controls.Pulverizador"
2026-03-12 01:00:21 +00:00
xmlns:ctrl="clr-namespace:OperationControl.Controls"
mc:Ignorable="d"
MinWidth="420"
MinHeight="150"
d:DesignWidth="900"
d:DesignHeight="180">
<UserControl.Resources>
2026-03-12 01:00:21 +00:00
<local:BarraTopConverter x:Key="BarraTopConverter" MinAlturaCm="50" MaxAlturaCm="80" TopMinPx="18" TopMaxPx="62"/>
<local:RuaWidthFisicaConverter x:Key="RuaWidthFisicaConverter"/>
<local:RuaOffsetFisicaConverter x:Key="RuaOffsetFisicaConverter"/>
<SolidColorBrush x:Key="CardBrush" Color="#FF162437"/>
<SolidColorBrush x:Key="LineBrush" Color="#FFD4DBE5"/>
<SolidColorBrush x:Key="TextPrimary" Color="#FFF5F7FA"/>
<SolidColorBrush x:Key="TextSecondary" Color="#FFB0BAC8"/>
2026-03-12 01:00:21 +00:00
<SolidColorBrush x:Key="GroundBrush" Color="#AA8B0000"/>
<SolidColorBrush x:Key="CropBrush" Color="#5F6A36"/>
2026-03-12 01:00:21 +00:00
<Style x:Key="SectionTitle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextSecondary}"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
2026-03-12 01:00:21 +00:00
<Style x:Key="InfoLabelStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextSecondary}"/>
2026-03-12 01:00:21 +00:00
<Setter Property="FontSize" Value="11"/>
</Style>
<Style x:Key="InfoValueStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
</UserControl.Resources>
2026-03-12 01:00:21 +00:00
<Border Background="{StaticResource CardBrush}" CornerRadius="12" Padding="12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="72"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
2026-03-12 01:00:21 +00:00
<!-- ===================== ESQUERDA ===================== -->
<Grid Grid.Column="0" Margin="0,0,10,0">
<Grid.RowDefinitions>
2026-03-12 01:00:21 +00:00
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
2026-03-12 01:00:21 +00:00
<RowDefinition Height="18"/>
</Grid.RowDefinitions>
2026-03-12 01:00:21 +00:00
<TextBlock Grid.Row="0" Text="{Binding AlturaBarra, RelativeSource={RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}, StringFormat={}{0:F0} cm}" Foreground="{StaticResource TextPrimary}" FontSize="16" FontWeight="SemiBold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Grid Grid.Row="1" x:Name="AreaRegua" Margin="0,8,0,30">
<!-- Slider -->
<Slider Minimum="50"
Maximum="80"
Value="{Binding AlturaBarra, RelativeSource={RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Orientation="Vertical"
Width="30"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
IsDirectionReversed="False"
Margin="0,0,0,0"/>
</Grid>
<Rectangle Grid.Row="2" Fill="Transparent"/>
</Grid>
<!-- ===================== CENTRO ===================== -->
<DockPanel Grid.Column="1" Margin="0,0,10,0" LastChildFill="True">
<!-- solo sempre colado embaixo -->
<Grid DockPanel.Dock="Bottom" Height="10" ClipToBounds="True" Margin="8,0,8,0">
<Border Background="{StaticResource CropBrush}" CornerRadius="0,0,8,8"/>
<Border HorizontalAlignment="Left" Background="{StaticResource GroundBrush}" CornerRadius="0,0,8,8">
<Border.Width>
<MultiBinding Converter="{StaticResource RuaWidthFisicaConverter}">
<Binding RelativeSource="{RelativeSource AncestorType=Grid}" Path="ActualWidth"/>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}" Path="LarguraRuaCm"/>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}" Path="ComprimentoBarraCm"/>
</MultiBinding>
</Border.Width>
<Border.Margin>
<MultiBinding Converter="{StaticResource RuaOffsetFisicaConverter}">
<Binding RelativeSource="{RelativeSource AncestorType=Grid}" Path="ActualWidth"/>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}" Path="ErroLateralCm"/>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}" Path="LarguraRuaCm"/>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}" Path="ComprimentoBarraCm"/>
</MultiBinding>
</Border.Margin>
</Border>
</Grid>
<!-- área dos bicos ocupa o restante -->
<Grid x:Name="AreaTecnica">
2026-03-12 01:00:21 +00:00
<Grid VerticalAlignment="Top">
<Grid.Margin>
<MultiBinding Converter="{StaticResource BarraTopConverter}" ConverterParameter="5">
<Binding RelativeSource="{RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}" Path="AlturaBarra"/>
<Binding ElementName="AreaTecnica" Path="ActualHeight"/>
</MultiBinding>
</Grid.Margin>
2026-03-12 01:00:21 +00:00
<!-- barra -->
<Border Height="5" Background="{StaticResource LineBrush}" CornerRadius="3" VerticalAlignment="Top"/>
2026-03-12 01:00:21 +00:00
<!-- bicos -->
<ItemsControl ItemsSource="{Binding Bicos, RelativeSource={RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}}" Margin="0,-35,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
2026-03-12 01:00:21 +00:00
<UniformGrid Rows="1" Columns="{Binding QtdBicos, RelativeSource={RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
2026-03-12 01:00:21 +00:00
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:BicoModel}">
2026-03-12 01:00:21 +00:00
<local:BicoLequeIndicator HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Margin="2,0,2,0"
AnguloControle="{Binding AnguloControle}"
OpeningAngle="{Binding OpeningAngle}"
IsCommandOn="{Binding IsCommandOn}"
IsSpraying="{Binding IsSpraying}"
Vazao="{Binding Vazao}"
TempoAtuado="{Binding TempoAtuado}"
Atuacoes="{Binding Atuacoes}"
Loaded="BicoLequeIndicator_Loaded" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
2026-03-12 01:00:21 +00:00
</Grid>
</Grid>
</DockPanel>
2026-03-12 01:00:21 +00:00
<!-- ===================== DIREITA ===================== -->
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="10"/>
<RowDefinition Height="*"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="Bomba"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource SectionTitle}">
<Setter Property="Foreground" Value="{StaticResource TextSecondary}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsBombaOn, RelativeSource={RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}}" Value="True">
<Setter Property="Foreground" Value="#4CD964"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Grid Grid.Row="1"
VerticalAlignment="Center"
Margin="0,2,0,2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Pressão -->
<Grid Grid.Row="0" Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Pressão"
Style="{StaticResource InfoLabelStyle}"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="1"
Text="{Binding PressaoLinha, RelativeSource={RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}, StringFormat={}{0:F1} psi}"
Foreground="{StaticResource TextPrimary}"
FontSize="13"
FontWeight="SemiBold"
VerticalAlignment="Center"/>
2025-12-04 13:51:11 +00:00
</Grid>
2026-03-12 01:00:21 +00:00
<!-- Tempo -->
<Grid Grid.Row="1" Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Tempo"
Style="{StaticResource InfoLabelStyle}"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="1"
Text="{Binding TempoAtuado, RelativeSource={RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}, StringFormat={}{0:F1} s}"
Foreground="{StaticResource TextPrimary}"
FontSize="13"
FontWeight="SemiBold"
VerticalAlignment="Center"/>
</Grid>
<!-- Vazão -->
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Vazão"
Style="{StaticResource InfoLabelStyle}"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="1"
Text="{Binding VazaoInstantanea, RelativeSource={RelativeSource AncestorType={x:Type ctrl:PulverizadorIndicator}}, StringFormat={}{0:F1} mL/s}"
Foreground="{StaticResource TextPrimary}"
FontSize="13"
FontWeight="SemiBold"
VerticalAlignment="Center"/>
</Grid>
</Grid>
</Grid>
2026-03-12 01:00:21 +00:00
</Grid>
</Border>
</UserControl>