Compare commits

...

3 Commits

Author SHA1 Message Date
Diego Freitas 8327561222 incluido ajustes do equipamento na ihm e comecado diagnosticos 2026-07-16 17:13:15 -03:00
Diego Freitas a22ad83812 Iniciado nova IHM 2026-07-15 16:20:57 -03:00
Diego Freitas 6523488d89 pequeno gaurd no weed detector contra overflow 2026-07-15 07:50:09 -03:00
60 changed files with 15999 additions and 8774 deletions

View File

@ -384,6 +384,58 @@
<Compile Include="Forms\frmPinout.Designer.cs">
<DependentUpon>frmPinout.cs</DependentUpon>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiCameraSelector.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiDiagnosticTabButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiMenuTile.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiMetricTile.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiModuleBadge.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiNetworkEditor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiNumericField.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiRoundedPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiShortcutButton.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiSidebarButton.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiStatusRow.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\HmiTheme.cs" />
<Compile Include="Forms\IHM\Controls\StatusOperacaoControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\IHM\Controls\StatusOperacaoControl.Designer.cs">
<DependentUpon>StatusOperacaoControl.cs</DependentUpon>
</Compile>
<Compile Include="Forms\IHM\frmDiagnosticos.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\IHM\frmDiagnosticos.Designer.cs">
<DependentUpon>frmDiagnosticos.cs</DependentUpon>
</Compile>
<Compile Include="Forms\IHM\frmMenu.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\IHM\frmMenu.Designer.cs">
<DependentUpon>frmMenu.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Simuladores\frmSimulacaoMapaGPS.cs">
<SubType>Form</SubType>
</Compile>
@ -408,11 +460,11 @@
<Compile Include="Forms\IHM\frmAjustes.Designer.cs">
<DependentUpon>frmAjustes.cs</DependentUpon>
</Compile>
<Compile Include="Forms\IHM\frmDiagnosticos.cs">
<Compile Include="Forms\IHM\frmTestes.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\IHM\frmDiagnosticos.Designer.cs">
<DependentUpon>frmDiagnosticos.cs</DependentUpon>
<Compile Include="Forms\IHM\frmTestes.Designer.cs">
<DependentUpon>frmTestes.cs</DependentUpon>
</Compile>
<Compile Include="Forms\IHM\frmDialogoMapa.cs">
<SubType>Form</SubType>
@ -643,6 +695,13 @@
<Content Include="icon.ico" />
<None Include="Imagens\logo.png" />
<None Include="Imagens\ads.jpg" />
<None Include="Imagens\testes.png" />
<None Include="Imagens\base.png" />
<None Include="Imagens\bateria.png" />
<None Include="Imagens\gnss.png" />
<None Include="Imagens\rede.png" />
<None Include="Imagens\reservatorio.png" />
<None Include="Imagens\temperatura.png" />
<Content Include="Python\Output\modelo_3d-1_0.mtl" />
<Content Include="Python\Output\modelo_3d-1_0.obj" />
<None Include="Resources\rede.png" />
@ -768,6 +827,14 @@
<EmbeddedResource Include="Forms\frmPinout.resx">
<DependentUpon>frmPinout.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\IHM\frmDiagnosticos.resx">
<DependentUpon>frmDiagnosticos.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\IHM\frmMenu.resx">
<DependentUpon>frmMenu.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Simuladores\frmSimulacaoMapaGPS.resx">
<DependentUpon>frmSimulacaoMapaGPS.cs</DependentUpon>
</EmbeddedResource>
@ -782,15 +849,17 @@
</EmbeddedResource>
<EmbeddedResource Include="Forms\IHM\frmAjustes.resx">
<DependentUpon>frmAjustes.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\IHM\frmDiagnosticos.resx">
<DependentUpon>frmDiagnosticos.cs</DependentUpon>
<EmbeddedResource Include="Forms\IHM\frmTestes.resx">
<DependentUpon>frmTestes.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\IHM\frmDialogoMapa.resx">
<DependentUpon>frmDialogoMapa.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\IHM\frmIHM.resx">
<DependentUpon>frmIHM.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Movimentacao\frmMovCamera.resx">
<DependentUpon>frmMovCamera.cs</DependentUpon>

View File

@ -0,0 +1,250 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
/// <summary>
/// Seleção de câmera com porta TCP, status e preview.
/// </summary>
[DefaultEvent("CameraChanged")]
public class HmiCameraSelector : UserControl
{
private readonly TableLayoutPanel _root;
private readonly TableLayoutPanel _info;
private readonly Label _lblTitulo;
private readonly Label _lblStatus;
private readonly ComboBox _cmbCamera;
private readonly NumericUpDown _nudPorta;
private readonly PictureBox _preview;
private readonly HmiSidebarButton _btnTestar;
public event EventHandler CameraChanged;
public event EventHandler TestRequested;
public event EventHandler ValueChanged;
public HmiCameraSelector()
{
DoubleBuffered = true;
BackColor = Color.Transparent;
Height = 86;
MinimumSize = new Size(250, 82);
Margin = new Padding(0, 1, 0, 4);
_root = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 2,
RowCount = 1,
Margin = Padding.Empty,
Padding = Padding.Empty
};
_root.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 67F));
_root.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
_root.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_info = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 2,
RowCount = 4,
Margin = Padding.Empty,
Padding = new Padding(0, 0, 7, 0)
};
_info.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 65F));
_info.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 35F));
_info.RowStyles.Add(new RowStyle(SizeType.Absolute, 19F));
_info.RowStyles.Add(new RowStyle(SizeType.Absolute, 13F));
_info.RowStyles.Add(new RowStyle(SizeType.Absolute, 27F));
_info.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_lblTitulo = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
BackColor = Color.Transparent,
ForeColor = HmiTheme.Info,
Font = new Font("Segoe UI", 9.25F, FontStyle.Bold),
Text = "Câmera",
TextAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty
};
_lblStatus = new Label
{
AutoSize = true,
Anchor = AnchorStyles.Right,
BackColor = Color.Transparent,
ForeColor = HmiTheme.TextMuted,
Font = new Font("Segoe UI", 7.5F, FontStyle.Bold),
Text = "Não selecionada",
TextAlign = ContentAlignment.MiddleRight,
Margin = Padding.Empty
};
Label lblDispositivo = CreateCaption("Dispositivo");
Label lblPorta = CreateCaption("Porta TCP");
_cmbCamera = new ComboBox
{
Dock = DockStyle.Fill,
DropDownStyle = ComboBoxStyle.DropDown,
FlatStyle = FlatStyle.Flat,
BackColor = HmiTheme.SurfaceRaised,
ForeColor = HmiTheme.Text,
Font = new Font("Segoe UI", 8.5F),
Margin = new Padding(0, 1, 5, 1)
};
_nudPorta = new NumericUpDown
{
Dock = DockStyle.Fill,
BackColor = HmiTheme.SurfaceRaised,
ForeColor = HmiTheme.Text,
BorderStyle = BorderStyle.FixedSingle,
Font = new Font("Segoe UI", 9F, FontStyle.Bold),
TextAlign = HorizontalAlignment.Center,
Minimum = 1,
Maximum = 65535,
Value = 8554,
Margin = new Padding(0, 1, 0, 1)
};
_btnTestar = new HmiSidebarButton
{
Dock = DockStyle.Left,
Width = 105,
Height = 31,
Text = "TESTAR",
IconText = "▶",
AccentColor = HmiTheme.Info,
BorderColor = HmiTheme.Border,
FillColor = HmiTheme.SurfaceRaised,
Margin = new Padding(0, 3, 0, 0)
};
_preview = new PictureBox
{
Dock = DockStyle.Fill,
BackColor = Color.Black,
BorderStyle = BorderStyle.FixedSingle,
SizeMode = PictureBoxSizeMode.Zoom,
Margin = Padding.Empty
};
_info.Controls.Add(_lblTitulo, 0, 0);
_info.Controls.Add(_lblStatus, 1, 0);
_info.Controls.Add(lblDispositivo, 0, 1);
_info.Controls.Add(lblPorta, 1, 1);
_info.Controls.Add(_cmbCamera, 0, 2);
_info.Controls.Add(_nudPorta, 1, 2);
_info.Controls.Add(_btnTestar, 0, 3);
_info.SetColumnSpan(_btnTestar, 2);
_root.Controls.Add(_info, 0, 0);
_root.Controls.Add(_preview, 1, 0);
Controls.Add(_root);
_cmbCamera.SelectedIndexChanged += delegate
{
if (CameraChanged != null)
CameraChanged(this, EventArgs.Empty);
RaiseValueChanged();
};
_nudPorta.ValueChanged += delegate { RaiseValueChanged(); };
_btnTestar.Click += delegate
{
if (TestRequested != null)
TestRequested(this, EventArgs.Empty);
};
}
private static Label CreateCaption(string text)
{
return new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
BackColor = Color.Transparent,
ForeColor = HmiTheme.TextMuted,
Font = new Font("Segoe UI", 7F),
Text = text,
TextAlign = ContentAlignment.BottomLeft,
Margin = Padding.Empty
};
}
private void RaiseValueChanged()
{
if (ValueChanged != null)
ValueChanged(this, EventArgs.Empty);
}
[Category("Conteúdo")]
public string Titulo
{
get { return _lblTitulo.Text; }
set { _lblTitulo.Text = value ?? string.Empty; }
}
[Category("Conteúdo")]
public string Status
{
get { return _lblStatus.Text; }
set { _lblStatus.Text = value ?? string.Empty; }
}
[Category("Aparência")]
public Color StatusColor
{
get { return _lblStatus.ForeColor; }
set { _lblStatus.ForeColor = value; }
}
[Browsable(false)]
public ComboBox CameraCombo
{
get { return _cmbCamera; }
}
[Category("Dados")]
public int PortaTcp
{
get { return Decimal.ToInt32(_nudPorta.Value); }
set
{
decimal ajustado = Math.Max(_nudPorta.Minimum, Math.Min(_nudPorta.Maximum, value));
_nudPorta.Value = ajustado;
}
}
[Category("Conteúdo")]
public Image Preview
{
get { return _preview.Image; }
set
{
Image anterior = _preview.Image;
_preview.Image = value;
if (anterior != null && anterior != value)
anterior.Dispose();
}
}
public void ClearPreview()
{
Preview = null;
_preview.BackColor = Color.Black;
}
}
}

View File

@ -0,0 +1,52 @@
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
public class HmiDiagnosticTabButton : Button
{
private bool _selected;
public HmiDiagnosticTabButton()
{
FlatStyle = FlatStyle.Flat;
FlatAppearance.BorderSize = 1;
FlatAppearance.BorderColor = HmiTheme.Border;
BackColor = HmiTheme.Surface;
ForeColor = HmiTheme.TextMuted;
Font = new Font("Segoe UI", 8F);
Cursor = Cursors.Hand;
Height = 32;
Margin = new Padding(1);
UseVisualStyleBackColor = false;
}
[Category("Estado")]
public bool Selected
{
get { return _selected; }
set
{
_selected = value;
AplicarEstado();
}
}
private void AplicarEstado()
{
if (_selected)
{
BackColor = Color.FromArgb(20, 59, 96);
ForeColor = HmiTheme.Text;
FlatAppearance.BorderColor = HmiTheme.Info;
}
else
{
BackColor = HmiTheme.Surface;
ForeColor = HmiTheme.TextMuted;
FlatAppearance.BorderColor = HmiTheme.Border;
}
}
}
}

View File

@ -0,0 +1,298 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
[DefaultEvent("Click")]
public class HmiMenuTile : UserControl
{
private readonly TableLayoutPanel _layout;
private readonly PictureBox _picIcone;
private readonly Label _lblTitulo;
private readonly Label _lblSubtitulo;
private Color _fillColor = HmiTheme.SurfaceRaised;
private Color _borderColor = HmiTheme.Border;
private Color _accentColor = HmiTheme.Success;
private int _cornerRadius = 13;
private bool _pressed;
public HmiMenuTile()
{
SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.ResizeRedraw |
ControlStyles.SupportsTransparentBackColor,
true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Cursor = Cursors.Hand;
MinimumSize = new Size(150, 110);
Margin = new Padding(6);
_layout = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 1,
RowCount = 3,
Margin = Padding.Empty,
Padding = new Padding(8, 7, 8, 7)
};
_layout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_layout.RowStyles.Add(new RowStyle(SizeType.Absolute, 27F));
_layout.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
_picIcone = new PictureBox
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.Zoom,
Margin = new Padding(48, 4, 48, 3),
Cursor = Cursors.Hand,
TabStop = false
};
_lblTitulo = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
BackColor = Color.Transparent,
ForeColor = HmiTheme.Text,
Font = new Font("Segoe UI", 13F, FontStyle.Bold),
Text = "TÍTULO",
TextAlign = ContentAlignment.MiddleCenter,
Margin = Padding.Empty,
Cursor = Cursors.Hand,
AutoEllipsis = true
};
_lblSubtitulo = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
BackColor = Color.Transparent,
ForeColor = HmiTheme.TextMuted,
Font = new Font("Segoe UI", 8.25F, FontStyle.Regular),
Text = string.Empty,
TextAlign = ContentAlignment.TopCenter,
Margin = Padding.Empty,
Cursor = Cursors.Hand,
AutoEllipsis = true
};
_layout.Controls.Add(_picIcone, 0, 0);
_layout.Controls.Add(_lblTitulo, 0, 1);
_layout.Controls.Add(_lblSubtitulo, 0, 2);
Controls.Add(_layout);
WireChild(_layout);
WireChild(_picIcone);
WireChild(_lblTitulo);
WireChild(_lblSubtitulo);
UpdateRoundedRegion();
}
[Category("Conteúdo")]
public Image Icone
{
get { return _picIcone.Image; }
set { _picIcone.Image = value; Invalidate(); }
}
[Category("Conteúdo")]
[DefaultValue("TÍTULO")]
public string Titulo
{
get { return _lblTitulo.Text; }
set { _lblTitulo.Text = value ?? string.Empty; }
}
[Category("Conteúdo")]
[DefaultValue("")]
public string Subtitulo
{
get { return _lblSubtitulo.Text; }
set { _lblSubtitulo.Text = value ?? string.Empty; }
}
[Category("Aparência")]
public Color FillColor
{
get { return _fillColor; }
set { _fillColor = value; Invalidate(); }
}
[Category("Aparência")]
public Color BorderColor
{
get { return _borderColor; }
set { _borderColor = value; Invalidate(); }
}
[Category("Aparência")]
public Color AccentColor
{
get { return _accentColor; }
set { _accentColor = value; Invalidate(); }
}
[Category("Aparência")]
[DefaultValue(13)]
public int CornerRadius
{
get { return _cornerRadius; }
set
{
_cornerRadius = Math.Max(0, value);
UpdateRoundedRegion();
Invalidate();
}
}
public void SetStatus(string text, Color color)
{
Subtitulo = text;
_lblSubtitulo.ForeColor = color;
}
protected override void OnEnabledChanged(EventArgs e)
{
base.OnEnabledChanged(e);
Cursor = Enabled ? Cursors.Hand : Cursors.Default;
_lblTitulo.ForeColor = Enabled ? HmiTheme.Text : HmiTheme.Disabled;
_lblSubtitulo.ForeColor = Enabled ? HmiTheme.TextMuted : HmiTheme.Disabled;
Invalidate();
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
UpdateRoundedRegion();
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (!Enabled || e.Button != MouseButtons.Left)
return;
_pressed = true;
Invalidate();
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
if (!_pressed)
return;
_pressed = false;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
if (!_pressed)
return;
_pressed = false;
Invalidate();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Color currentFill = _pressed
? HmiTheme.SurfacePressed
: _fillColor;
if (!Enabled)
currentFill = Color.FromArgb(22, 25, 28);
var bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (var path = HmiRoundedPanel.CreateRoundedPath(bounds, _cornerRadius))
using (var brush = new SolidBrush(currentFill))
{
e.Graphics.FillPath(brush, path);
}
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Color border = Enabled ? _accentColor : HmiTheme.Disabled;
var bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (var path = HmiRoundedPanel.CreateRoundedPath(bounds, _cornerRadius))
using (var pen = new Pen(border, _pressed ? 2F : 1.25F))
{
e.Graphics.DrawPath(pen, path);
}
using (var pen = new Pen(Color.FromArgb(120, border), 3F))
{
pen.StartCap = LineCap.Round;
pen.EndCap = LineCap.Round;
e.Graphics.DrawLine(pen, 18, 8, Math.Max(18, Width - 18), 8);
}
base.OnPaint(e);
}
private void WireChild(Control child)
{
child.Click += Child_Click;
child.MouseDown += Child_MouseDown;
child.MouseUp += Child_MouseUp;
child.MouseLeave += Child_MouseLeave;
}
private void Child_Click(object sender, EventArgs e)
{
if (Enabled)
OnClick(e);
}
private void Child_MouseDown(object sender, MouseEventArgs e)
{
OnMouseDown(e);
}
private void Child_MouseUp(object sender, MouseEventArgs e)
{
OnMouseUp(e);
}
private void Child_MouseLeave(object sender, EventArgs e)
{
OnMouseLeave(e);
}
private void UpdateRoundedRegion()
{
if (Width <= 0 || Height <= 0)
return;
using (var path = HmiRoundedPanel.CreateRoundedPath(
new Rectangle(0, 0, Width, Height),
_cornerRadius))
{
if (Region != null)
Region.Dispose();
Region = new Region(path);
}
}
}
}

View File

@ -0,0 +1,72 @@
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
public class HmiMetricTile : UserControl
{
private readonly Label _lblCaption;
private readonly Label _lblValue;
public HmiMetricTile()
{
BackColor = HmiTheme.SurfaceRaised;
Margin = new Padding(3);
Padding = new Padding(6, 3, 6, 3);
Height = 48;
MinimumSize = Size.Empty;
_lblCaption = new Label
{
Dock = DockStyle.Top,
Height = 18,
AutoSize = false,
AutoEllipsis = true,
BackColor = Color.Transparent,
ForeColor = HmiTheme.TextMuted,
Font = new Font("Segoe UI", 7F),
Text = "Métrica",
TextAlign = ContentAlignment.MiddleCenter,
Margin = Padding.Empty
};
_lblValue = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
AutoEllipsis = true,
BackColor = Color.Transparent,
ForeColor = HmiTheme.Info,
Font = new Font("Segoe UI", 10F, FontStyle.Bold),
Text = "0",
TextAlign = ContentAlignment.MiddleCenter,
Margin = Padding.Empty
};
Controls.Add(_lblValue);
Controls.Add(_lblCaption);
}
[Category("Conteúdo")]
public string Caption
{
get { return _lblCaption.Text; }
set { _lblCaption.Text = value ?? string.Empty; }
}
[Category("Conteúdo")]
public string ValueText
{
get { return _lblValue.Text; }
set { _lblValue.Text = value ?? string.Empty; }
}
[Category("Aparência")]
public Color ValueColor
{
get { return _lblValue.ForeColor; }
set { _lblValue.ForeColor = value; }
}
}
}

View File

@ -0,0 +1,173 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
public enum HmiModuleState
{
Operante = 0,
Alerta = 1,
Falha = 2,
Desconectado = 3,
Selecionado = 4
}
[DefaultEvent("Click")]
public class HmiModuleBadge : Control
{
private HmiModuleState _state = HmiModuleState.Operante;
private string _moduleCode = "MOD";
public HmiModuleBadge()
{
SetStyle(
ControlStyles.SupportsTransparentBackColor |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.ResizeRedraw,
true);
DoubleBuffered = true;
BackColor = Color.Transparent;
ForeColor = HmiTheme.Text;
Cursor = Cursors.Hand;
Font = new Font("Segoe UI", 8F, FontStyle.Bold);
Size = new Size(45, 27);
MinimumSize = new Size(42, 26);
UpdateStyles();
}
[Category("Conteúdo")]
public string ModuleCode
{
get { return _moduleCode; }
set
{
_moduleCode = value ?? string.Empty;
Invalidate();
}
}
[Category("Estado")]
public HmiModuleState State
{
get { return _state; }
set
{
_state = value;
Invalidate();
}
}
private Color Accent
{
get
{
switch (_state)
{
case HmiModuleState.Alerta:
return HmiTheme.Warning;
case HmiModuleState.Falha:
return HmiTheme.Danger;
case HmiModuleState.Desconectado:
return HmiTheme.TextMuted;
case HmiModuleState.Selecionado:
return HmiTheme.Info;
case HmiModuleState.Operante:
default:
return HmiTheme.Success;
}
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Rectangle rect = new Rectangle(0, 0, Width - 1, Height - 1);
using (GraphicsPath path = CriarCaminhoArredondado(rect, 7))
{
Color accent = Accent;
using (SolidBrush fill = new SolidBrush(
Color.FromArgb(34, accent.R, accent.G, accent.B)))
{
e.Graphics.FillPath(fill, path);
}
using (Pen border = new Pen(
accent,
_state == HmiModuleState.Selecionado ? 2F : 1.2F))
{
e.Graphics.DrawPath(border, path);
}
}
TextRenderer.DrawText(
e.Graphics,
_moduleCode,
Font,
rect,
_state == HmiModuleState.Desconectado
? HmiTheme.TextMuted
: HmiTheme.Text,
TextFormatFlags.HorizontalCenter |
TextFormatFlags.VerticalCenter |
TextFormatFlags.EndEllipsis);
}
private static GraphicsPath CriarCaminhoArredondado(
Rectangle bounds,
int radius)
{
GraphicsPath path = new GraphicsPath();
int diameter = radius * 2;
path.AddArc(
bounds.Left,
bounds.Top,
diameter,
diameter,
180,
90);
path.AddArc(
bounds.Right - diameter,
bounds.Top,
diameter,
diameter,
270,
90);
path.AddArc(
bounds.Right - diameter,
bounds.Bottom - diameter,
diameter,
diameter,
0,
90);
path.AddArc(
bounds.Left,
bounds.Bottom - diameter,
diameter,
diameter,
90,
90);
path.CloseFigure();
return path;
}
}
}

View File

@ -0,0 +1,307 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
/// <summary>
/// Editor compacto de interface, IP, máscara e gateway.
/// </summary>
[DefaultEvent("InterfaceChanged")]
public class HmiNetworkEditor : UserControl
{
private readonly TableLayoutPanel _root;
private readonly TableLayoutPanel _fields;
private readonly Label _lblTitulo;
private readonly Label _lblStatus;
private readonly ComboBox _cmbInterface;
private readonly TextBox _txtIp;
private readonly TextBox _txtMask;
private readonly TextBox _txtGateway;
public event EventHandler InterfaceChanged;
public event EventHandler ValueChanged;
public HmiNetworkEditor()
{
DoubleBuffered = true;
BackColor = Color.Transparent;
Height = 67;
MinimumSize = new Size(250, 63);
Margin = new Padding(0, 2, 0, 3);
_root = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 2,
RowCount = 2,
Margin = Padding.Empty,
Padding = Padding.Empty
};
_root.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
_root.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
_root.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
_root.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_lblTitulo = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
BackColor = Color.Transparent,
ForeColor = HmiTheme.Info,
Font = new Font("Segoe UI", 9.25F, FontStyle.Bold),
Text = "Rede",
TextAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty
};
_lblStatus = new Label
{
AutoSize = true,
Anchor = AnchorStyles.Right,
BackColor = Color.Transparent,
ForeColor = HmiTheme.TextMuted,
Font = new Font("Segoe UI", 7.75F, FontStyle.Bold),
Text = "Não testada",
TextAlign = ContentAlignment.MiddleRight,
Margin = new Padding(5, 0, 0, 0)
};
_fields = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 4,
RowCount = 2,
Margin = Padding.Empty,
Padding = Padding.Empty
};
_fields.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 22F));
_fields.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 27F));
_fields.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 27F));
_fields.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 24F));
_fields.RowStyles.Add(new RowStyle(SizeType.Absolute, 18F));
_fields.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
AddCaption("Interface", 0);
AddCaption("IP", 1);
AddCaption("Máscara", 2);
AddCaption("Gateway", 3);
_cmbInterface = CreateCombo();
_txtIp = CreateText();
_txtMask = CreateText();
_txtGateway = CreateText();
_fields.Controls.Add(_cmbInterface, 0, 1);
_fields.Controls.Add(_txtIp, 1, 1);
_fields.Controls.Add(_txtMask, 2, 1);
_fields.Controls.Add(_txtGateway, 3, 1);
_root.Controls.Add(_lblTitulo, 0, 0);
_root.Controls.Add(_lblStatus, 1, 0);
_root.Controls.Add(_fields, 0, 1);
_root.SetColumnSpan(_fields, 2);
Controls.Add(_root);
_cmbInterface.SelectedIndexChanged += delegate
{
if (InterfaceChanged != null)
InterfaceChanged(this, EventArgs.Empty);
RaiseValueChanged();
};
_txtIp.TextChanged += delegate { RaiseValueChanged(); };
_txtMask.TextChanged += delegate { RaiseValueChanged(); };
_txtGateway.TextChanged += delegate { RaiseValueChanged(); };
}
public void DefinirInterfaces(IEnumerable<string> interfaces, string interfaceSelecionada = null)
{
string selecaoAnterior = interfaceSelecionada ?? InterfaceName;
_cmbInterface.BeginUpdate();
try
{
_cmbInterface.Items.Clear();
if (interfaces != null)
{
_cmbInterface.Items.AddRange(
interfaces
.Where(x => !string.IsNullOrWhiteSpace(x))
.Distinct()
.Cast<object>()
.ToArray()
);
}
SelecionarInterface(selecaoAnterior);
}
finally
{
_cmbInterface.EndUpdate();
}
}
private void AddCaption(string text, int column)
{
_fields.Controls.Add(new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
BackColor = Color.Transparent,
ForeColor = HmiTheme.TextMuted,
Font = new Font("Segoe UI", 7F),
Text = text,
TextAlign = ContentAlignment.BottomLeft,
Margin = Padding.Empty
}, column, 0);
}
private static ComboBox CreateCombo()
{
return new ComboBox
{
Dock = DockStyle.Fill,
DropDownStyle = ComboBoxStyle.DropDownList,
FlatStyle = FlatStyle.Flat,
BackColor = HmiTheme.SurfaceRaised,
ForeColor = HmiTheme.Text,
Font = new Font("Segoe UI", 8F),
Margin = new Padding(0, 1, 4, 0)
};
}
private static TextBox CreateText()
{
return new TextBox
{
Dock = DockStyle.Fill,
BackColor = HmiTheme.SurfaceRaised,
ForeColor = HmiTheme.Text,
BorderStyle = BorderStyle.FixedSingle,
Font = new Font("Segoe UI", 7.8F),
TextAlign = HorizontalAlignment.Center,
Margin = new Padding(0, 1, 4, 0)
};
}
private void RaiseValueChanged()
{
if (ValueChanged != null)
ValueChanged(this, EventArgs.Empty);
}
[Category("Conteúdo")]
public string Titulo
{
get { return _lblTitulo.Text; }
set { _lblTitulo.Text = value ?? string.Empty; }
}
[Category("Conteúdo")]
public string Status
{
get { return _lblStatus.Text; }
set { _lblStatus.Text = value ?? string.Empty; }
}
[Category("Aparência")]
public Color StatusColor
{
get { return _lblStatus.ForeColor; }
set { _lblStatus.ForeColor = value; }
}
[Browsable(false)]
public ComboBox InterfaceCombo
{
get { return _cmbInterface; }
}
[Category("Dados")]
public string InterfaceName
{
get
{
return ObterNomeInterface(_cmbInterface.Text);
}
set
{
SelecionarInterface(value);
}
}
private void SelecionarInterface(string interfaceDesejada)
{
interfaceDesejada = ObterNomeInterface(interfaceDesejada);
if (string.IsNullOrWhiteSpace(interfaceDesejada))
{
_cmbInterface.SelectedIndex = -1;
return;
}
for (int i = 0; i < _cmbInterface.Items.Count; i++)
{
string itemCompleto = Convert.ToString(_cmbInterface.Items[i]);
string nomeItem = ObterNomeInterface(itemCompleto);
if (string.Equals(nomeItem, interfaceDesejada, StringComparison.OrdinalIgnoreCase))
{
_cmbInterface.SelectedIndex = i;
return;
}
}
_cmbInterface.SelectedIndex = -1;
}
private static string ObterNomeInterface(string texto)
{
if (string.IsNullOrWhiteSpace(texto))
return string.Empty;
int indiceParenteses = texto.IndexOf('(');
if (indiceParenteses >= 0)
{
texto = texto.Substring(0, indiceParenteses);
}
return texto.Trim();
}
[Category("Dados")]
public string Ip
{
get { return _txtIp.Text; }
set { _txtIp.Text = value ?? string.Empty; }
}
[Category("Dados")]
public string Mask
{
get { return _txtMask.Text; }
set { _txtMask.Text = value ?? string.Empty; }
}
[Category("Dados")]
public string Gateway
{
get { return _txtGateway.Text; }
set { _txtGateway.Text = value ?? string.Empty; }
}
}
}

View File

@ -0,0 +1,159 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
/// <summary>
/// Campo numérico compacto, padronizado e amigável para touchscreen.
/// </summary>
[DefaultEvent("ValueChanged")]
public class HmiNumericField : UserControl
{
private readonly TableLayoutPanel _layout;
private readonly Label _lblTitulo;
private readonly NumericUpDown _numeric;
private readonly Label _lblUnidade;
public event EventHandler ValueChanged;
public HmiNumericField()
{
DoubleBuffered = true;
BackColor = Color.Transparent;
Height = 53;
MinimumSize = Size.Empty;
Dock = DockStyle.Fill;
Margin = new Padding(2);
_layout = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 2,
RowCount = 2,
Margin = Padding.Empty,
Padding = Padding.Empty
};
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
_layout.RowStyles.Add(new RowStyle(SizeType.Absolute, 21F));
_layout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_lblTitulo = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
AutoEllipsis = true,
BackColor = Color.Transparent,
ForeColor = HmiTheme.TextMuted,
Font = new Font("Segoe UI", 7.6F, FontStyle.Regular),
Text = "Parâmetro",
TextAlign = ContentAlignment.BottomLeft,
Margin = Padding.Empty
};
_numeric = new NumericUpDown
{
Dock = DockStyle.Fill,
BackColor = HmiTheme.SurfaceRaised,
ForeColor = HmiTheme.Text,
BorderStyle = BorderStyle.FixedSingle,
Font = new Font("Segoe UI", 10.5F, FontStyle.Bold),
TextAlign = HorizontalAlignment.Center,
DecimalPlaces = 1,
Minimum = -100000,
Maximum = 100000,
Increment = 1,
Margin = new Padding(0, 2, 4, 0),
ThousandsSeparator = false
};
_lblUnidade = new Label
{
AutoSize = true,
Anchor = AnchorStyles.Right,
BackColor = Color.Transparent,
ForeColor = HmiTheme.TextMuted,
Font = new Font("Segoe UI", 8F, FontStyle.Bold),
Text = string.Empty,
TextAlign = ContentAlignment.MiddleRight,
Margin = new Padding(3, 0, 2, 0)
};
_layout.Controls.Add(_lblTitulo, 0, 0);
_layout.SetColumnSpan(_lblTitulo, 2);
_layout.Controls.Add(_numeric, 0, 1);
_layout.Controls.Add(_lblUnidade, 1, 1);
Controls.Add(_layout);
_numeric.ValueChanged += delegate
{
if (ValueChanged != null)
ValueChanged(this, EventArgs.Empty);
};
}
[Category("Conteúdo")]
public string Titulo
{
get { return _lblTitulo.Text; }
set { _lblTitulo.Text = value ?? string.Empty; }
}
[Category("Conteúdo")]
public string Unidade
{
get { return _lblUnidade.Text; }
set { _lblUnidade.Text = value ?? string.Empty; }
}
[Category("Dados")]
public decimal Value
{
get { return _numeric.Value; }
set
{
decimal ajustado = Math.Max(_numeric.Minimum, Math.Min(_numeric.Maximum, value));
_numeric.Value = ajustado;
}
}
[Category("Dados")]
public decimal Minimum
{
get { return _numeric.Minimum; }
set { _numeric.Minimum = value; }
}
[Category("Dados")]
public decimal Maximum
{
get { return _numeric.Maximum; }
set { _numeric.Maximum = value; }
}
[Category("Dados")]
public decimal Increment
{
get { return _numeric.Increment; }
set { _numeric.Increment = value; }
}
[Category("Dados")]
public int DecimalPlaces
{
get { return _numeric.DecimalPlaces; }
set { _numeric.DecimalPlaces = Math.Max(0, Math.Min(4, value)); }
}
[Browsable(false)]
public NumericUpDown NumericControl
{
get { return _numeric; }
}
}
}

View File

@ -0,0 +1,197 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
public class HmiRoundedPanel : UserControl
{
private Color _fillColor = HmiTheme.Surface;
private Color _borderColor = HmiTheme.Border;
private Color _accentColor = HmiTheme.Success;
private int _cornerRadius = 12;
private int _borderThickness = 1;
private int _accentWidth = 4;
private bool _showAccent;
public HmiRoundedPanel()
{
SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.ResizeRedraw |
ControlStyles.SupportsTransparentBackColor,
true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Padding = new Padding(12);
MinimumSize = new Size(30, 30);
}
[Category("Aparência")]
public Color FillColor
{
get { return _fillColor; }
set { _fillColor = value; Invalidate(); }
}
[Category("Aparência")]
public Color BorderColor
{
get { return _borderColor; }
set { _borderColor = value; Invalidate(); }
}
[Category("Aparência")]
public Color AccentColor
{
get { return _accentColor; }
set { _accentColor = value; Invalidate(); }
}
[Category("Aparência")]
[DefaultValue(false)]
public bool ShowAccent
{
get { return _showAccent; }
set { _showAccent = value; Invalidate(); }
}
[Category("Aparência")]
[DefaultValue(12)]
public int CornerRadius
{
get { return _cornerRadius; }
set
{
_cornerRadius = Math.Max(0, value);
UpdateRoundedRegion();
Invalidate();
}
}
[Category("Aparência")]
[DefaultValue(1)]
public int BorderThickness
{
get { return _borderThickness; }
set
{
_borderThickness = Math.Max(0, value);
Invalidate();
}
}
[Category("Aparência")]
[DefaultValue(4)]
public int AccentWidth
{
get { return _accentWidth; }
set
{
_accentWidth = Math.Max(1, value);
Invalidate();
}
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
UpdateRoundedRegion();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
var bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (var path = CreateRoundedPath(bounds, _cornerRadius))
using (var brush = new SolidBrush(_fillColor))
{
e.Graphics.FillPath(brush, path);
}
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
var bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (var path = CreateRoundedPath(bounds, _cornerRadius))
{
if (_borderThickness > 0)
{
using (var pen = new Pen(_borderColor, _borderThickness))
{
e.Graphics.DrawPath(pen, path);
}
}
}
if (_showAccent && Height > 20)
{
using (var pen = new Pen(_accentColor, _accentWidth))
{
pen.StartCap = LineCap.Round;
pen.EndCap = LineCap.Round;
e.Graphics.DrawLine(
pen,
Padding.Left / 2,
12,
Padding.Left / 2,
Height - 12);
}
}
base.OnPaint(e);
}
private void UpdateRoundedRegion()
{
if (Width <= 0 || Height <= 0)
return;
var bounds = new Rectangle(0, 0, Width, Height);
using (var path = CreateRoundedPath(bounds, _cornerRadius))
{
if (Region != null)
Region.Dispose();
Region = new Region(path);
}
}
internal static GraphicsPath CreateRoundedPath(Rectangle bounds, int radius)
{
var path = new GraphicsPath();
if (radius <= 0)
{
path.AddRectangle(bounds);
path.CloseFigure();
return path;
}
int diameter = Math.Min(radius * 2, Math.Min(bounds.Width, bounds.Height));
var arc = new Rectangle(bounds.X, bounds.Y, diameter, diameter);
path.AddArc(arc, 180, 90);
arc.X = bounds.Right - diameter;
path.AddArc(arc, 270, 90);
arc.Y = bounds.Bottom - diameter;
path.AddArc(arc, 0, 90);
arc.X = bounds.Left;
path.AddArc(arc, 90, 90);
path.CloseFigure();
return path;
}
}
}

View File

@ -0,0 +1,241 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
[DefaultEvent("Click")]
public class HmiShortcutButton : UserControl
{
private readonly TableLayoutPanel _layout;
private readonly Label _lblIcon;
private readonly Label _lblText;
private readonly Label _lblArrow;
private Color _fillColor = Color.FromArgb(27, 33, 37);
private Color _borderColor = HmiTheme.BorderSoft;
private Color _accentColor = HmiTheme.Success;
private int _cornerRadius = 9;
private bool _pressed;
public HmiShortcutButton()
{
SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.ResizeRedraw |
ControlStyles.SupportsTransparentBackColor,
true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Cursor = Cursors.Hand;
Height = 35;
MinimumSize = new Size(140, 34);
Margin = new Padding(0, 3, 0, 3);
_layout = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 3,
RowCount = 1,
Margin = Padding.Empty,
Padding = new Padding(9, 0, 8, 0)
};
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 32F));
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 22F));
_layout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_lblIcon = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
Text = "",
TextAlign = ContentAlignment.MiddleCenter,
ForeColor = _accentColor,
BackColor = Color.Transparent,
Font = new Font("Segoe UI Symbol", 15F, FontStyle.Bold),
Margin = Padding.Empty,
Cursor = Cursors.Hand
};
_lblText = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
Text = "Atalho",
TextAlign = ContentAlignment.MiddleLeft,
ForeColor = HmiTheme.Text,
BackColor = Color.Transparent,
Font = new Font("Segoe UI", 9.25F, FontStyle.Regular),
AutoEllipsis = true,
Margin = Padding.Empty,
Cursor = Cursors.Hand
};
_lblArrow = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
Text = "",
TextAlign = ContentAlignment.MiddleRight,
ForeColor = HmiTheme.TextMuted,
BackColor = Color.Transparent,
Font = new Font("Segoe UI", 17F, FontStyle.Regular),
Margin = Padding.Empty,
Cursor = Cursors.Hand
};
_layout.Controls.Add(_lblIcon, 0, 0);
_layout.Controls.Add(_lblText, 1, 0);
_layout.Controls.Add(_lblArrow, 2, 0);
Controls.Add(_layout);
WireChild(_layout);
WireChild(_lblIcon);
WireChild(_lblText);
WireChild(_lblArrow);
UpdateRoundedRegion();
}
[Category("Conteúdo")]
public string Texto
{
get { return _lblText.Text; }
set { _lblText.Text = value ?? string.Empty; }
}
[Category("Conteúdo")]
public string IconText
{
get { return _lblIcon.Text; }
set { _lblIcon.Text = value ?? string.Empty; }
}
[Category("Aparência")]
public Color AccentColor
{
get { return _accentColor; }
set
{
_accentColor = value;
_lblIcon.ForeColor = value;
Invalidate();
}
}
[Category("Aparência")]
public Color FillColor
{
get { return _fillColor; }
set { _fillColor = value; Invalidate(); }
}
[Category("Aparência")]
public Color BorderColor
{
get { return _borderColor; }
set { _borderColor = value; Invalidate(); }
}
[Category("Aparência")]
[DefaultValue(9)]
public int CornerRadius
{
get { return _cornerRadius; }
set
{
_cornerRadius = Math.Max(0, value);
UpdateRoundedRegion();
Invalidate();
}
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
UpdateRoundedRegion();
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button != MouseButtons.Left)
return;
_pressed = true;
Invalidate();
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
_pressed = false;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
_pressed = false;
Invalidate();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Color fill = _pressed ? HmiTheme.SurfacePressed : _fillColor;
var bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (var path = HmiRoundedPanel.CreateRoundedPath(bounds, _cornerRadius))
using (var brush = new SolidBrush(fill))
{
e.Graphics.FillPath(brush, path);
}
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
var bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (var path = HmiRoundedPanel.CreateRoundedPath(bounds, _cornerRadius))
using (var pen = new Pen(_pressed ? _accentColor : _borderColor, _pressed ? 1.5F : 1F))
{
e.Graphics.DrawPath(pen, path);
}
base.OnPaint(e);
}
private void WireChild(Control child)
{
child.Click += delegate { OnClick(EventArgs.Empty); };
child.MouseDown += delegate(object sender, MouseEventArgs e) { OnMouseDown(e); };
child.MouseUp += delegate(object sender, MouseEventArgs e) { OnMouseUp(e); };
child.MouseLeave += delegate { OnMouseLeave(EventArgs.Empty); };
}
private void UpdateRoundedRegion()
{
if (Width <= 0 || Height <= 0)
return;
using (var path = HmiRoundedPanel.CreateRoundedPath(
new Rectangle(0, 0, Width, Height),
_cornerRadius))
{
if (Region != null)
Region.Dispose();
Region = new Region(path);
}
}
}
}

View File

@ -0,0 +1,337 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
/// <summary>
/// Botão touch reutilizável para ações da barra lateral.
/// </summary>
[DefaultEvent("Click")]
public class HmiSidebarButton : UserControl
{
private readonly TableLayoutPanel _layout;
private readonly Label _lblIcone;
private readonly Label _lblTexto;
private Color _fillColor = HmiTheme.SurfaceRaised;
private Color _borderColor = HmiTheme.Border;
private Color _accentColor = HmiTheme.Success;
private int _cornerRadius = 9;
private bool _pressionado;
public HmiSidebarButton()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Cursor = Cursors.Hand;
Height = 38;
MinimumSize = new Size(130, 36);
Margin = new Padding(0, 2, 0, 2);
Padding = Padding.Empty;
_layout = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 2,
RowCount = 1,
Margin = Padding.Empty,
Padding = new Padding(9, 2, 10, 2)
};
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 32F));
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
_layout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_lblIcone = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
BackColor = Color.Transparent,
ForeColor = _accentColor,
Font = new Font("Segoe UI Symbol", 12F, FontStyle.Bold),
Text = "●",
TextAlign = ContentAlignment.MiddleCenter,
Margin = Padding.Empty,
Cursor = Cursors.Hand
};
_lblTexto = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
AutoEllipsis = true,
BackColor = Color.Transparent,
ForeColor = HmiTheme.Text,
Font = new Font("Segoe UI", 8.5F, FontStyle.Bold),
Text = "AÇÃO",
TextAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty,
Cursor = Cursors.Hand
};
_layout.Controls.Add(_lblIcone, 0, 0);
_layout.Controls.Add(_lblTexto, 1, 0);
Controls.Add(_layout);
EncaminharEventos(_layout);
EncaminharEventos(_lblIcone);
EncaminharEventos(_lblTexto);
AtualizarRegiaoArredondada();
}
[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Always)]
[Bindable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Category("Conteúdo")]
[Description("Texto exibido no botão.")]
[DefaultValue("AÇÃO")]
public override string Text
{
get => _lblTexto.Text;
set
{
string texto = value ?? string.Empty;
base.Text = texto;
_lblTexto.Text = texto;
Invalidate();
}
}
[Category("Conteúdo")]
[DefaultValue("●")]
public string IconText
{
get { return _lblIcone.Text; }
set { _lblIcone.Text = value ?? string.Empty; }
}
[Category("Aparência")]
public Color FillColor
{
get { return _fillColor; }
set
{
_fillColor = value;
Invalidate();
}
}
[Category("Aparência")]
public Color BorderColor
{
get { return _borderColor; }
set
{
_borderColor = value;
Invalidate();
}
}
[Category("Aparência")]
public Color AccentColor
{
get { return _accentColor; }
set
{
_accentColor = value;
_lblIcone.ForeColor = value;
Invalidate();
}
}
[Category("Aparência")]
[DefaultValue(9)]
public int CornerRadius
{
get { return _cornerRadius; }
set
{
_cornerRadius = Math.Max(0, value);
AtualizarRegiaoArredondada();
Invalidate();
}
}
protected override void OnEnabledChanged(EventArgs e)
{
base.OnEnabledChanged(e);
Cursor = Enabled
? Cursors.Hand
: Cursors.Default;
_lblTexto.ForeColor = Enabled
? HmiTheme.Text
: HmiTheme.Disabled;
_lblIcone.ForeColor = Enabled
? _accentColor
: HmiTheme.Disabled;
Invalidate();
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
AtualizarRegiaoArredondada();
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (!Enabled || e.Button != MouseButtons.Left)
return;
_pressionado = true;
Invalidate();
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
if (!_pressionado)
return;
_pressionado = false;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
if (!_pressionado)
return;
_pressionado = false;
Invalidate();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Color fill = _pressionado
? HmiTheme.SurfacePressed
: _fillColor;
if (!Enabled)
fill = Color.FromArgb(21, 25, 28);
Rectangle bounds = new Rectangle(
0,
0,
Math.Max(1, Width - 1),
Math.Max(1, Height - 1));
using (GraphicsPath path =
HmiRoundedPanel.CreateRoundedPath(
bounds,
_cornerRadius))
using (SolidBrush brush = new SolidBrush(fill))
{
e.Graphics.FillPath(brush, path);
}
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Color border = Enabled
? _borderColor
: HmiTheme.Disabled;
Rectangle bounds = new Rectangle(
0,
0,
Math.Max(1, Width - 1),
Math.Max(1, Height - 1));
using (GraphicsPath path =
HmiRoundedPanel.CreateRoundedPath(
bounds,
_cornerRadius))
using (Pen pen = new Pen(
_pressionado ? _accentColor : border,
_pressionado ? 1.6F : 1F))
{
e.Graphics.DrawPath(pen, path);
}
using (Pen accentPen = new Pen(
Enabled ? _accentColor : HmiTheme.Disabled,
3F))
{
accentPen.StartCap = LineCap.Round;
accentPen.EndCap = LineCap.Round;
e.Graphics.DrawLine(
accentPen,
6,
10,
6,
Height - 10);
}
base.OnPaint(e);
}
private void EncaminharEventos(Control control)
{
control.Click += delegate
{
if (Enabled)
OnClick(EventArgs.Empty);
};
control.MouseDown += delegate(object sender, MouseEventArgs e)
{
OnMouseDown(e);
};
control.MouseUp += delegate(object sender, MouseEventArgs e)
{
OnMouseUp(e);
};
control.MouseLeave += delegate
{
OnMouseLeave(EventArgs.Empty);
};
}
private void AtualizarRegiaoArredondada()
{
if (Width <= 0 || Height <= 0)
return;
using (GraphicsPath path =
HmiRoundedPanel.CreateRoundedPath(
new Rectangle(0, 0, Width, Height),
_cornerRadius))
{
if (Region != null)
Region.Dispose();
Region = new Region(path);
}
}
}
}

View File

@ -0,0 +1,216 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
[DefaultEvent("Click")]
public class HmiStatusRow : UserControl
{
private readonly TableLayoutPanel _layout;
private readonly Label _lblIndicator;
private readonly Label _lblTitle;
private readonly Label _lblValue;
private Color _fillColor = Color.FromArgb(27, 33, 37);
private Color _borderColor = HmiTheme.BorderSoft;
private Color _statusColor = HmiTheme.TextMuted;
private int _cornerRadius = 8;
public HmiStatusRow()
{
SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.ResizeRedraw |
ControlStyles.SupportsTransparentBackColor,
true);
DoubleBuffered = true;
BackColor = Color.Transparent;
Height = 31;
MinimumSize = new Size(120, 29);
Margin = new Padding(0, 2, 0, 2);
_layout = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 3,
RowCount = 1,
Margin = Padding.Empty,
Padding = new Padding(8, 0, 8, 0)
};
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 18F));
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
_layout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_lblIndicator = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
Text = "●",
TextAlign = ContentAlignment.MiddleLeft,
ForeColor = _statusColor,
BackColor = Color.Transparent,
Font = new Font("Segoe UI", 8F, FontStyle.Bold),
Margin = Padding.Empty
};
_lblTitle = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
Text = "Status",
TextAlign = ContentAlignment.MiddleLeft,
ForeColor = HmiTheme.Text,
BackColor = Color.Transparent,
Font = new Font("Segoe UI", 8.5F, FontStyle.Regular),
AutoEllipsis = true,
Margin = Padding.Empty
};
_lblValue = new Label
{
AutoSize = true,
Anchor = AnchorStyles.Right,
Text = "-",
TextAlign = ContentAlignment.MiddleRight,
ForeColor = _statusColor,
BackColor = Color.Transparent,
Font = new Font("Segoe UI", 8.5F, FontStyle.Bold),
Margin = new Padding(8, 0, 0, 0)
};
_layout.Controls.Add(_lblIndicator, 0, 0);
_layout.Controls.Add(_lblTitle, 1, 0);
_layout.Controls.Add(_lblValue, 2, 0);
Controls.Add(_layout);
WireChild(_layout);
WireChild(_lblIndicator);
WireChild(_lblTitle);
WireChild(_lblValue);
UpdateRoundedRegion();
}
[Category("Conteúdo")]
public string Titulo
{
get { return _lblTitle.Text; }
set { _lblTitle.Text = value ?? string.Empty; }
}
[Category("Conteúdo")]
public string Valor
{
get { return _lblValue.Text; }
set { _lblValue.Text = value ?? string.Empty; }
}
[Category("Aparência")]
public Color StatusColor
{
get { return _statusColor; }
set
{
_statusColor = value;
_lblIndicator.ForeColor = value;
_lblValue.ForeColor = value;
Invalidate();
}
}
[Category("Aparência")]
public Color FillColor
{
get { return _fillColor; }
set { _fillColor = value; Invalidate(); }
}
[Category("Aparência")]
public Color BorderColor
{
get { return _borderColor; }
set { _borderColor = value; Invalidate(); }
}
[Category("Aparência")]
[DefaultValue(8)]
public int CornerRadius
{
get { return _cornerRadius; }
set
{
_cornerRadius = Math.Max(0, value);
UpdateRoundedRegion();
Invalidate();
}
}
public void SetStatus(string value, Color color)
{
Valor = value;
StatusColor = color;
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
UpdateRoundedRegion();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
var bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (var path = HmiRoundedPanel.CreateRoundedPath(bounds, _cornerRadius))
using (var brush = new SolidBrush(_fillColor))
{
e.Graphics.FillPath(brush, path);
}
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
var bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (var path = HmiRoundedPanel.CreateRoundedPath(bounds, _cornerRadius))
using (var pen = new Pen(_borderColor, 1F))
{
e.Graphics.DrawPath(pen, path);
}
base.OnPaint(e);
}
private void WireChild(Control child)
{
child.Click += delegate { OnClick(EventArgs.Empty); };
child.Cursor = Cursors.Hand;
}
private void UpdateRoundedRegion()
{
if (Width <= 0 || Height <= 0)
return;
using (var path = HmiRoundedPanel.CreateRoundedPath(
new Rectangle(0, 0, Width, Height),
_cornerRadius))
{
if (Region != null)
Region.Dispose();
Region = new Region(path);
}
}
}
}

View File

@ -0,0 +1,30 @@
using System.Drawing;
namespace AgroBase.Forms.IHM.Controls
{
/// <summary>
/// Paleta central da IHM. Altere as cores aqui para atualizar todas as telas.
/// </summary>
public static class HmiTheme
{
public static readonly Color Background = Color.FromArgb(12, 17, 20);
public static readonly Color Surface = Color.FromArgb(24, 29, 33);
public static readonly Color SurfaceRaised = Color.FromArgb(30, 36, 41);
public static readonly Color SurfacePressed = Color.FromArgb(19, 24, 28);
public static readonly Color Header = Color.FromArgb(15, 48, 38);
public static readonly Color Border = Color.FromArgb(53, 63, 69);
public static readonly Color BorderSoft = Color.FromArgb(42, 51, 57);
public static readonly Color Text = Color.FromArgb(241, 245, 247);
public static readonly Color TextMuted = Color.FromArgb(164, 174, 181);
public static readonly Color Success = Color.FromArgb(72, 210, 122);
public static readonly Color Info = Color.FromArgb(61, 165, 255);
public static readonly Color Manual = Color.FromArgb(155, 106, 222);
public static readonly Color Warning = Color.FromArgb(244, 181, 68);
public static readonly Color Danger = Color.FromArgb(239, 83, 80);
public static readonly Color Disabled = Color.FromArgb(92, 101, 107);
}
}

View File

@ -0,0 +1,37 @@
namespace AgroBase.Forms.IHM.Controls
{
partial class StatusOperacaoControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

View File

@ -0,0 +1,393 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace AgroBase.Forms.IHM.Controls
{
/// <summary>
/// Card compacto utilizado na barra lateral da IHM.
/// Mantém compatibilidade com as propriedades do componente anterior.
/// </summary>
[DefaultEvent("Click")]
public partial class StatusOperacaoControl : UserControl
{
private readonly TableLayoutPanel _layout;
private readonly PictureBox _picIcone;
private readonly Label _lblTitulo;
private readonly Label _lblValor;
private Color _corFundo = HmiTheme.SurfaceRaised;
private Color _corBorda = HmiTheme.BorderSoft;
private Color _corDestaque = HmiTheme.Success;
private int _raioBorda = 10;
private bool _mostrarDestaque = true;
public StatusOperacaoControl()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
DoubleBuffered = true;
BackColor = Color.Transparent;
ForeColor = HmiTheme.Text;
Height = 42;
MinimumSize = new Size(130, 40);
Margin = new Padding(0, 0, 0, 5);
Padding = Padding.Empty;
Cursor = Cursors.Default;
_layout = new TableLayoutPanel
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
ColumnCount = 3,
RowCount = 1,
Margin = Padding.Empty,
Padding = new Padding(12, 3, 10, 3)
};
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 29F));
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
_layout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
_layout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
_picIcone = new PictureBox
{
Dock = DockStyle.Fill,
BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.Zoom,
Margin = new Padding(1, 7, 7, 7),
Padding = Padding.Empty,
TabStop = false
};
_lblTitulo = new Label
{
AutoSize = true,
Anchor = AnchorStyles.Left,
AutoEllipsis = false,
BackColor = Color.Transparent,
ForeColor = HmiTheme.Text,
Font = new Font("Segoe UI", 8.25F, FontStyle.Regular),
Text = "Título",
TextAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty,
Padding = Padding.Empty,
MaximumSize = new Size(105, 0)
};
_lblValor = new Label
{
Dock = DockStyle.Fill,
AutoSize = false,
AutoEllipsis = true,
BackColor = Color.Transparent,
ForeColor = HmiTheme.Success,
Font = new Font("Segoe UI", 8.25F, FontStyle.Bold),
Text = "0",
TextAlign = ContentAlignment.MiddleRight,
Margin = new Padding(6, 0, 0, 0),
Padding = Padding.Empty
};
_layout.Controls.Add(_picIcone, 0, 0);
_layout.Controls.Add(_lblTitulo, 1, 0);
_layout.Controls.Add(_lblValor, 2, 0);
Controls.Add(_layout);
EncaminharClique(_layout);
EncaminharClique(_picIcone);
EncaminharClique(_lblTitulo);
EncaminharClique(_lblValor);
AtualizarRegiaoArredondada();
}
[Category("Conteúdo")]
[Description("Ícone exibido no lado esquerdo.")]
public Image Icone
{
get { return _picIcone.Image; }
set
{
_picIcone.Image = value;
_picIcone.Visible = value != null;
Invalidate();
}
}
[Category("Conteúdo")]
[DefaultValue("Título")]
public string Titulo
{
get => _lblTitulo.Text;
set
{
_lblTitulo.Text = value ?? string.Empty;
AjustarFonteTitulo();
PerformLayout();
}
}
[Category("Conteúdo")]
[DefaultValue("0")]
public string Valor
{
get { return _lblValor.Text; }
set
{
_lblValor.Text = value ?? string.Empty;
if (IsHandleCreated)
BeginInvoke(new Action(AjustarFonteValor));
}
}
[Category("Aparência")]
public Color CorValor
{
get { return _lblValor.ForeColor; }
set
{
_lblValor.ForeColor = value;
Invalidate();
}
}
[Category("Aparência")]
public Color CorTitulo
{
get { return _lblTitulo.ForeColor; }
set
{
_lblTitulo.ForeColor = value;
Invalidate();
}
}
[Category("Aparência")]
public Color CorFundo
{
get { return _corFundo; }
set
{
_corFundo = value;
Invalidate();
}
}
[Category("Aparência")]
public Color CorBorda
{
get { return _corBorda; }
set
{
_corBorda = value;
Invalidate();
}
}
[Category("Aparência")]
public Color CorDestaque
{
get { return _corDestaque; }
set
{
_corDestaque = value;
Invalidate();
}
}
[Category("Aparência")]
[DefaultValue(true)]
public bool MostrarDestaque
{
get { return _mostrarDestaque; }
set
{
_mostrarDestaque = value;
Invalidate();
}
}
[Category("Aparência")]
[DefaultValue(10)]
public int RaioBorda
{
get { return _raioBorda; }
set
{
_raioBorda = Math.Max(0, value);
AtualizarRegiaoArredondada();
Invalidate();
}
}
public void AtualizarStatus(string valor, Color? corValor = null, Color? corDestaque = null)
{
Valor = valor;
if (corValor.HasValue)
CorValor = corValor.Value;
if (corDestaque.HasValue)
CorDestaque = corDestaque.Value;
}
protected override void OnEnabledChanged(EventArgs e)
{
base.OnEnabledChanged(e);
_lblTitulo.ForeColor = Enabled ? HmiTheme.Text : HmiTheme.Disabled;
_lblValor.ForeColor = Enabled ? _lblValor.ForeColor : HmiTheme.Disabled;
Invalidate();
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
AtualizarRegiaoArredondada();
AjustarFonteValor();
AjustarFonteTitulo();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Rectangle bounds = new Rectangle( 0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (GraphicsPath path = HmiRoundedPanel.CreateRoundedPath(bounds, _raioBorda))
using (SolidBrush brush = new SolidBrush(_corFundo))
{
e.Graphics.FillPath(brush, path);
}
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Rectangle bounds = new Rectangle(0, 0, Math.Max(1, Width - 1), Math.Max(1, Height - 1));
using (GraphicsPath path = HmiRoundedPanel.CreateRoundedPath(bounds, _raioBorda))
using (Pen pen = new Pen(_corBorda, 1F))
{
e.Graphics.DrawPath(pen, path);
}
if (_mostrarDestaque && Height > 20)
{
using (Pen accentPen = new Pen(_corDestaque, 3F))
{
accentPen.StartCap = LineCap.Round;
accentPen.EndCap = LineCap.Round;
e.Graphics.DrawLine(accentPen, 6, 11, 6, Height - 11);
}
}
base.OnPaint(e);
}
private void EncaminharClique(Control control)
{
control.Click += delegate
{
OnClick(EventArgs.Empty);
};
}
private void AtualizarRegiaoArredondada()
{
if (Width <= 0 || Height <= 0)
return;
using (GraphicsPath path = HmiRoundedPanel.CreateRoundedPath(new Rectangle(0, 0, Width, Height), _raioBorda))
{
if (Region != null)
Region.Dispose();
Region = new Region(path);
}
}
private void AjustarFonteValor()
{
if (string.IsNullOrWhiteSpace(_lblValor?.Text))
return;
const float tamanhoMaximo = 8.25F;
const float tamanhoMinimo = 6.75F;
float tamanho = tamanhoMaximo;
using (Graphics graphics = _lblValor.CreateGraphics())
{
while (tamanho > tamanhoMinimo)
{
using (Font fonteTeste = new Font("Segoe UI", tamanho, FontStyle.Bold))
{
SizeF tamanhoTexto = graphics.MeasureString(_lblValor.Text, fonteTeste);
if (tamanhoTexto.Width <= _lblValor.ClientSize.Width - 2)
{
break;
}
}
tamanho -= 0.25F;
}
}
Font fonteAntiga = _lblValor.Font;
_lblValor.Font = new Font("Segoe UI", tamanho, FontStyle.Bold);
fonteAntiga?.Dispose();
}
private void AjustarFonteTitulo()
{
if (string.IsNullOrWhiteSpace(_lblTitulo?.Text))
return;
const float fonteMaxima = 8.25F;
const float fonteMinima = 7F;
float tamanhoFonte = fonteMaxima;
int larguraMaxima = 105;
while (tamanhoFonte > fonteMinima)
{
using (Font fonteTeste = new Font("Segoe UI", tamanhoFonte, FontStyle.Regular))
{
Size tamanhoTexto = TextRenderer.MeasureText(_lblTitulo.Text, fonteTeste, new Size(int.MaxValue, Height), TextFormatFlags.SingleLine | TextFormatFlags.NoPadding);
if (tamanhoTexto.Width <= larguraMaxima)
break;
}
tamanhoFonte -= 0.25F;
}
if (Math.Abs(_lblTitulo.Font.Size - tamanhoFonte) < 0.01F)
return;
Font fonteAnterior = _lblTitulo.Font;
_lblTitulo.Font = new Font("Segoe UI", tamanhoFonte, FontStyle.Regular);
fonteAnterior.Dispose();
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,885 @@
namespace AgroBase.Forms.IHM
{
partial class frmMenu
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.rootLayout = new System.Windows.Forms.TableLayoutPanel();
this.pnlHeader = new AgroBase.Forms.IHM.Controls.HmiRoundedPanel();
this.headerLayout = new System.Windows.Forms.TableLayoutPanel();
this.headerTextLayout = new System.Windows.Forms.TableLayoutPanel();
this.lblTitulo = new System.Windows.Forms.Label();
this.lblStatus = new System.Windows.Forms.Label();
this.pnlRoverStatus = new AgroBase.Forms.IHM.Controls.HmiRoundedPanel();
this.roverStatusLayout = new System.Windows.Forms.TableLayoutPanel();
this.lblRoverDot = new System.Windows.Forms.Label();
this.lblRoverNome = new System.Windows.Forms.Label();
this.lblRoverProntidao = new System.Windows.Forms.Label();
this.gridAcoes = new System.Windows.Forms.TableLayoutPanel();
this.tileOperacao = new AgroBase.Forms.IHM.Controls.HmiMenuTile();
this.tileModoManual = new AgroBase.Forms.IHM.Controls.HmiMenuTile();
this.tileDiagnosticos = new AgroBase.Forms.IHM.Controls.HmiMenuTile();
this.tileAjustes = new AgroBase.Forms.IHM.Controls.HmiMenuTile();
this.tileTestes = new AgroBase.Forms.IHM.Controls.HmiMenuTile();
this.tileDesligar = new AgroBase.Forms.IHM.Controls.HmiMenuTile();
this.gridInferior = new System.Windows.Forms.TableLayoutPanel();
this.pnlStatusRapido = new AgroBase.Forms.IHM.Controls.HmiRoundedPanel();
this.statusLayout = new System.Windows.Forms.TableLayoutPanel();
this.lblTituloStatus = new System.Windows.Forms.Label();
this.rowOperacaoLiberada = new AgroBase.Forms.IHM.Controls.HmiStatusRow();
this.rowMqtt = new AgroBase.Forms.IHM.Controls.HmiStatusRow();
this.rowIA = new AgroBase.Forms.IHM.Controls.HmiStatusRow();
this.rowFalhas = new AgroBase.Forms.IHM.Controls.HmiStatusRow();
this.pnlAtalhos = new AgroBase.Forms.IHM.Controls.HmiRoundedPanel();
this.atalhosLayout = new System.Windows.Forms.TableLayoutPanel();
this.lblTituloAtalhos = new System.Windows.Forms.Label();
this.btnDebugMode = new AgroBase.Forms.IHM.Controls.HmiShortcutButton();
this.btnAjustarLeverArm = new AgroBase.Forms.IHM.Controls.HmiShortcutButton();
this.btnSincronizarArquivos = new AgroBase.Forms.IHM.Controls.HmiShortcutButton();
this.pnlAtualizacoes = new AgroBase.Forms.IHM.Controls.HmiRoundedPanel();
this.atualizacaoLayout = new System.Windows.Forms.TableLayoutPanel();
this.lblTituloAtualizacoes = new System.Windows.Forms.Label();
this.picWifi = new System.Windows.Forms.PictureBox();
this.lblAtualizacaoResumo = new System.Windows.Forms.Label();
this.pgbAtualizacaoArquivos = new System.Windows.Forms.ProgressBar();
this.lblProgressoAtualizacao = new System.Windows.Forms.Label();
this.pnlFooter = new System.Windows.Forms.Panel();
this.footerLayout = new System.Windows.Forms.TableLayoutPanel();
this.lblVersao = new System.Windows.Forms.Label();
this.lblConexaoFooter = new System.Windows.Forms.Label();
this.rootLayout.SuspendLayout();
this.pnlHeader.SuspendLayout();
this.headerLayout.SuspendLayout();
this.headerTextLayout.SuspendLayout();
this.pnlRoverStatus.SuspendLayout();
this.roverStatusLayout.SuspendLayout();
this.gridAcoes.SuspendLayout();
this.gridInferior.SuspendLayout();
this.pnlStatusRapido.SuspendLayout();
this.statusLayout.SuspendLayout();
this.pnlAtalhos.SuspendLayout();
this.atalhosLayout.SuspendLayout();
this.pnlAtualizacoes.SuspendLayout();
this.atualizacaoLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picWifi)).BeginInit();
this.pnlFooter.SuspendLayout();
this.footerLayout.SuspendLayout();
this.SuspendLayout();
//
// rootLayout
//
this.rootLayout.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(12)))), ((int)(((byte)(17)))), ((int)(((byte)(20)))));
this.rootLayout.ColumnCount = 1;
this.rootLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.rootLayout.Controls.Add(this.pnlHeader, 0, 0);
this.rootLayout.Controls.Add(this.gridAcoes, 0, 1);
this.rootLayout.Controls.Add(this.gridInferior, 0, 2);
this.rootLayout.Controls.Add(this.pnlFooter, 0, 3);
this.rootLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.rootLayout.Location = new System.Drawing.Point(0, 0);
this.rootLayout.Margin = new System.Windows.Forms.Padding(0);
this.rootLayout.Name = "rootLayout";
this.rootLayout.Padding = new System.Windows.Forms.Padding(10, 9, 10, 7);
this.rootLayout.RowCount = 4;
this.rootLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 72F));
this.rootLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 305F));
this.rootLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.rootLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.rootLayout.Size = new System.Drawing.Size(800, 600);
this.rootLayout.TabIndex = 0;
//
// pnlHeader
//
this.pnlHeader.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.pnlHeader.BackColor = System.Drawing.Color.Transparent;
this.pnlHeader.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(83)))), ((int)(((byte)(67)))));
this.pnlHeader.Controls.Add(this.headerLayout);
this.pnlHeader.CornerRadius = 13;
this.pnlHeader.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlHeader.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(48)))), ((int)(((byte)(38)))));
this.pnlHeader.Location = new System.Drawing.Point(10, 9);
this.pnlHeader.Margin = new System.Windows.Forms.Padding(0, 0, 0, 6);
this.pnlHeader.MinimumSize = new System.Drawing.Size(30, 30);
this.pnlHeader.Name = "pnlHeader";
this.pnlHeader.Padding = new System.Windows.Forms.Padding(15, 8, 12, 8);
this.pnlHeader.ShowAccent = true;
this.pnlHeader.Size = new System.Drawing.Size(780, 66);
this.pnlHeader.TabIndex = 0;
//
// headerLayout
//
this.headerLayout.BackColor = System.Drawing.Color.Transparent;
this.headerLayout.ColumnCount = 2;
this.headerLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.headerLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 222F));
this.headerLayout.Controls.Add(this.headerTextLayout, 0, 0);
this.headerLayout.Controls.Add(this.pnlRoverStatus, 1, 0);
this.headerLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.headerLayout.Location = new System.Drawing.Point(15, 8);
this.headerLayout.Margin = new System.Windows.Forms.Padding(0);
this.headerLayout.Name = "headerLayout";
this.headerLayout.RowCount = 1;
this.headerLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.headerLayout.Size = new System.Drawing.Size(753, 50);
this.headerLayout.TabIndex = 0;
//
// headerTextLayout
//
this.headerTextLayout.BackColor = System.Drawing.Color.Transparent;
this.headerTextLayout.ColumnCount = 1;
this.headerTextLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.headerTextLayout.Controls.Add(this.lblTitulo, 0, 0);
this.headerTextLayout.Controls.Add(this.lblStatus, 0, 1);
this.headerTextLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.headerTextLayout.Location = new System.Drawing.Point(0, 0);
this.headerTextLayout.Margin = new System.Windows.Forms.Padding(0);
this.headerTextLayout.Name = "headerTextLayout";
this.headerTextLayout.RowCount = 2;
this.headerTextLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 62F));
this.headerTextLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 38F));
this.headerTextLayout.Size = new System.Drawing.Size(531, 50);
this.headerTextLayout.TabIndex = 0;
//
// lblTitulo
//
this.lblTitulo.AutoEllipsis = true;
this.lblTitulo.BackColor = System.Drawing.Color.Transparent;
this.lblTitulo.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTitulo.Font = new System.Drawing.Font("Segoe UI", 19F, System.Drawing.FontStyle.Bold);
this.lblTitulo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(245)))), ((int)(((byte)(247)))));
this.lblTitulo.Location = new System.Drawing.Point(0, 0);
this.lblTitulo.Margin = new System.Windows.Forms.Padding(0);
this.lblTitulo.Name = "lblTitulo";
this.lblTitulo.Size = new System.Drawing.Size(531, 31);
this.lblTitulo.TabIndex = 0;
this.lblTitulo.Text = "MENU DO EQUIPAMENTO";
this.lblTitulo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblStatus
//
this.lblStatus.AutoEllipsis = true;
this.lblStatus.BackColor = System.Drawing.Color.Transparent;
this.lblStatus.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblStatus.Font = new System.Drawing.Font("Segoe UI", 9.5F);
this.lblStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(218)))), ((int)(((byte)(211)))));
this.lblStatus.Location = new System.Drawing.Point(0, 31);
this.lblStatus.Margin = new System.Windows.Forms.Padding(0);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(531, 19);
this.lblStatus.TabIndex = 1;
this.lblStatus.Text = "Acesso rápido para operação em campo";
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pnlRoverStatus
//
this.pnlRoverStatus.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.pnlRoverStatus.BackColor = System.Drawing.Color.Transparent;
this.pnlRoverStatus.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(91)))), ((int)(((byte)(73)))));
this.pnlRoverStatus.Controls.Add(this.roverStatusLayout);
this.pnlRoverStatus.CornerRadius = 10;
this.pnlRoverStatus.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlRoverStatus.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(58)))), ((int)(((byte)(46)))));
this.pnlRoverStatus.Location = new System.Drawing.Point(537, 0);
this.pnlRoverStatus.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.pnlRoverStatus.MinimumSize = new System.Drawing.Size(30, 30);
this.pnlRoverStatus.Name = "pnlRoverStatus";
this.pnlRoverStatus.Padding = new System.Windows.Forms.Padding(9, 4, 9, 4);
this.pnlRoverStatus.Size = new System.Drawing.Size(216, 50);
this.pnlRoverStatus.TabIndex = 1;
//
// roverStatusLayout
//
this.roverStatusLayout.BackColor = System.Drawing.Color.Transparent;
this.roverStatusLayout.ColumnCount = 2;
this.roverStatusLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.roverStatusLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.roverStatusLayout.Controls.Add(this.lblRoverDot, 0, 0);
this.roverStatusLayout.Controls.Add(this.lblRoverNome, 1, 0);
this.roverStatusLayout.Controls.Add(this.lblRoverProntidao, 1, 1);
this.roverStatusLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.roverStatusLayout.Location = new System.Drawing.Point(9, 4);
this.roverStatusLayout.Margin = new System.Windows.Forms.Padding(0);
this.roverStatusLayout.Name = "roverStatusLayout";
this.roverStatusLayout.RowCount = 2;
this.roverStatusLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 53F));
this.roverStatusLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 47F));
this.roverStatusLayout.Size = new System.Drawing.Size(198, 42);
this.roverStatusLayout.TabIndex = 0;
//
// lblRoverDot
//
this.lblRoverDot.BackColor = System.Drawing.Color.Transparent;
this.lblRoverDot.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblRoverDot.Font = new System.Drawing.Font("Segoe UI", 21F, System.Drawing.FontStyle.Bold);
this.lblRoverDot.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.lblRoverDot.Location = new System.Drawing.Point(0, 0);
this.lblRoverDot.Margin = new System.Windows.Forms.Padding(0);
this.lblRoverDot.Name = "lblRoverDot";
this.roverStatusLayout.SetRowSpan(this.lblRoverDot, 2);
this.lblRoverDot.Size = new System.Drawing.Size(35, 42);
this.lblRoverDot.TabIndex = 0;
this.lblRoverDot.Text = "●";
this.lblRoverDot.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblRoverNome
//
this.lblRoverNome.BackColor = System.Drawing.Color.Transparent;
this.lblRoverNome.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblRoverNome.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold);
this.lblRoverNome.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(245)))), ((int)(((byte)(247)))));
this.lblRoverNome.Location = new System.Drawing.Point(35, 0);
this.lblRoverNome.Margin = new System.Windows.Forms.Padding(0);
this.lblRoverNome.Name = "lblRoverNome";
this.lblRoverNome.Size = new System.Drawing.Size(163, 22);
this.lblRoverNome.TabIndex = 1;
this.lblRoverNome.Text = "ROVER 01";
this.lblRoverNome.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// lblRoverProntidao
//
this.lblRoverProntidao.AutoEllipsis = true;
this.lblRoverProntidao.BackColor = System.Drawing.Color.Transparent;
this.lblRoverProntidao.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblRoverProntidao.Font = new System.Drawing.Font("Segoe UI", 8.5F, System.Drawing.FontStyle.Bold);
this.lblRoverProntidao.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.lblRoverProntidao.Location = new System.Drawing.Point(35, 22);
this.lblRoverProntidao.Margin = new System.Windows.Forms.Padding(0);
this.lblRoverProntidao.Name = "lblRoverProntidao";
this.lblRoverProntidao.Size = new System.Drawing.Size(163, 20);
this.lblRoverProntidao.TabIndex = 2;
this.lblRoverProntidao.Text = "Pronto para operação";
//
// gridAcoes
//
this.gridAcoes.BackColor = System.Drawing.Color.Transparent;
this.gridAcoes.ColumnCount = 3;
this.gridAcoes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.gridAcoes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.gridAcoes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.gridAcoes.Controls.Add(this.tileOperacao, 0, 0);
this.gridAcoes.Controls.Add(this.tileModoManual, 1, 0);
this.gridAcoes.Controls.Add(this.tileDiagnosticos, 2, 0);
this.gridAcoes.Controls.Add(this.tileAjustes, 0, 1);
this.gridAcoes.Controls.Add(this.tileTestes, 1, 1);
this.gridAcoes.Controls.Add(this.tileDesligar, 2, 1);
this.gridAcoes.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridAcoes.Location = new System.Drawing.Point(10, 81);
this.gridAcoes.Margin = new System.Windows.Forms.Padding(0);
this.gridAcoes.Name = "gridAcoes";
this.gridAcoes.RowCount = 2;
this.gridAcoes.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.gridAcoes.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.gridAcoes.Size = new System.Drawing.Size(780, 305);
this.gridAcoes.TabIndex = 1;
//
// tileOperacao
//
this.tileOperacao.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.tileOperacao.BackColor = System.Drawing.Color.Transparent;
this.tileOperacao.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.tileOperacao.Cursor = System.Windows.Forms.Cursors.Hand;
this.tileOperacao.Dock = System.Windows.Forms.DockStyle.Fill;
this.tileOperacao.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(36)))), ((int)(((byte)(41)))));
this.tileOperacao.Icone = global::AgroBase.Properties.Resources.cana;
this.tileOperacao.Location = new System.Drawing.Point(6, 6);
this.tileOperacao.Margin = new System.Windows.Forms.Padding(6);
this.tileOperacao.MinimumSize = new System.Drawing.Size(150, 110);
this.tileOperacao.Name = "tileOperacao";
this.tileOperacao.Size = new System.Drawing.Size(248, 140);
this.tileOperacao.Subtitulo = "Aguardando parâmetros";
this.tileOperacao.TabIndex = 0;
this.tileOperacao.Titulo = "OPERAÇÃO";
//
// tileModoManual
//
this.tileModoManual.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(106)))), ((int)(((byte)(222)))));
this.tileModoManual.BackColor = System.Drawing.Color.Transparent;
this.tileModoManual.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.tileModoManual.Cursor = System.Windows.Forms.Cursors.Hand;
this.tileModoManual.Dock = System.Windows.Forms.DockStyle.Fill;
this.tileModoManual.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(36)))), ((int)(((byte)(41)))));
this.tileModoManual.Icone = global::AgroBase.Properties.Resources.joystick;
this.tileModoManual.Location = new System.Drawing.Point(266, 6);
this.tileModoManual.Margin = new System.Windows.Forms.Padding(6);
this.tileModoManual.MinimumSize = new System.Drawing.Size(150, 110);
this.tileModoManual.Name = "tileModoManual";
this.tileModoManual.Size = new System.Drawing.Size(248, 140);
this.tileModoManual.Subtitulo = "Controle local por joystick";
this.tileModoManual.TabIndex = 1;
this.tileModoManual.Titulo = "MODO MANUAL";
//
// tileDiagnosticos
//
this.tileDiagnosticos.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(61)))), ((int)(((byte)(165)))), ((int)(((byte)(255)))));
this.tileDiagnosticos.BackColor = System.Drawing.Color.Transparent;
this.tileDiagnosticos.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.tileDiagnosticos.Cursor = System.Windows.Forms.Cursors.Hand;
this.tileDiagnosticos.Dock = System.Windows.Forms.DockStyle.Fill;
this.tileDiagnosticos.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(36)))), ((int)(((byte)(41)))));
this.tileDiagnosticos.Icone = global::AgroBase.Properties.Resources.diagnostico;
this.tileDiagnosticos.Location = new System.Drawing.Point(526, 6);
this.tileDiagnosticos.Margin = new System.Windows.Forms.Padding(6);
this.tileDiagnosticos.MinimumSize = new System.Drawing.Size(150, 110);
this.tileDiagnosticos.Name = "tileDiagnosticos";
this.tileDiagnosticos.Size = new System.Drawing.Size(248, 140);
this.tileDiagnosticos.Subtitulo = "Saúde e testes individuais";
this.tileDiagnosticos.TabIndex = 2;
this.tileDiagnosticos.Titulo = "DIAGNÓSTICO";
//
// tileAjustes
//
this.tileAjustes.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(134)))), ((int)(((byte)(215)))));
this.tileAjustes.BackColor = System.Drawing.Color.Transparent;
this.tileAjustes.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.tileAjustes.Cursor = System.Windows.Forms.Cursors.Hand;
this.tileAjustes.Dock = System.Windows.Forms.DockStyle.Fill;
this.tileAjustes.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(36)))), ((int)(((byte)(41)))));
this.tileAjustes.Icone = global::AgroBase.Properties.Resources.ajustes;
this.tileAjustes.Location = new System.Drawing.Point(6, 158);
this.tileAjustes.Margin = new System.Windows.Forms.Padding(6);
this.tileAjustes.MinimumSize = new System.Drawing.Size(150, 110);
this.tileAjustes.Name = "tileAjustes";
this.tileAjustes.Size = new System.Drawing.Size(248, 141);
this.tileAjustes.Subtitulo = "Parâmetros do equipamento";
this.tileAjustes.TabIndex = 3;
this.tileAjustes.Titulo = "AJUSTES";
//
// tileTestes
//
this.tileTestes.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(181)))), ((int)(((byte)(68)))));
this.tileTestes.BackColor = System.Drawing.Color.Transparent;
this.tileTestes.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.tileTestes.Cursor = System.Windows.Forms.Cursors.Hand;
this.tileTestes.Dock = System.Windows.Forms.DockStyle.Fill;
this.tileTestes.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(36)))), ((int)(((byte)(41)))));
this.tileTestes.Icone = global::AgroBase.Properties.Resources.testes;
this.tileTestes.Location = new System.Drawing.Point(266, 158);
this.tileTestes.Margin = new System.Windows.Forms.Padding(6);
this.tileTestes.MinimumSize = new System.Drawing.Size(150, 110);
this.tileTestes.Name = "tileTestes";
this.tileTestes.Size = new System.Drawing.Size(248, 141);
this.tileTestes.Subtitulo = "Verificação interna";
this.tileTestes.TabIndex = 4;
this.tileTestes.Titulo = "TESTES";
//
// tileDesligar
//
this.tileDesligar.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(83)))), ((int)(((byte)(80)))));
this.tileDesligar.BackColor = System.Drawing.Color.Transparent;
this.tileDesligar.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.tileDesligar.Cursor = System.Windows.Forms.Cursors.Hand;
this.tileDesligar.Dock = System.Windows.Forms.DockStyle.Fill;
this.tileDesligar.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(36)))), ((int)(((byte)(41)))));
this.tileDesligar.Icone = global::AgroBase.Properties.Resources.desligar;
this.tileDesligar.Location = new System.Drawing.Point(526, 158);
this.tileDesligar.Margin = new System.Windows.Forms.Padding(6);
this.tileDesligar.MinimumSize = new System.Drawing.Size(150, 110);
this.tileDesligar.Name = "tileDesligar";
this.tileDesligar.Size = new System.Drawing.Size(248, 141);
this.tileDesligar.Subtitulo = "Encerrar o equipamento";
this.tileDesligar.TabIndex = 5;
this.tileDesligar.Titulo = "DESLIGAR";
//
// gridInferior
//
this.gridInferior.BackColor = System.Drawing.Color.Transparent;
this.gridInferior.ColumnCount = 3;
this.gridInferior.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34F));
this.gridInferior.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 41F));
this.gridInferior.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.gridInferior.Controls.Add(this.pnlStatusRapido, 0, 0);
this.gridInferior.Controls.Add(this.pnlAtalhos, 1, 0);
this.gridInferior.Controls.Add(this.pnlAtualizacoes, 2, 0);
this.gridInferior.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridInferior.Location = new System.Drawing.Point(10, 386);
this.gridInferior.Margin = new System.Windows.Forms.Padding(0);
this.gridInferior.Name = "gridInferior";
this.gridInferior.RowCount = 1;
this.gridInferior.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.gridInferior.Size = new System.Drawing.Size(780, 182);
this.gridInferior.TabIndex = 2;
//
// pnlStatusRapido
//
this.pnlStatusRapido.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.pnlStatusRapido.BackColor = System.Drawing.Color.Transparent;
this.pnlStatusRapido.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.pnlStatusRapido.Controls.Add(this.statusLayout);
this.pnlStatusRapido.CornerRadius = 11;
this.pnlStatusRapido.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlStatusRapido.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(29)))), ((int)(((byte)(33)))));
this.pnlStatusRapido.Location = new System.Drawing.Point(6, 5);
this.pnlStatusRapido.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.pnlStatusRapido.MinimumSize = new System.Drawing.Size(30, 30);
this.pnlStatusRapido.Name = "pnlStatusRapido";
this.pnlStatusRapido.Padding = new System.Windows.Forms.Padding(10, 7, 10, 7);
this.pnlStatusRapido.Size = new System.Drawing.Size(253, 172);
this.pnlStatusRapido.TabIndex = 0;
//
// statusLayout
//
this.statusLayout.BackColor = System.Drawing.Color.Transparent;
this.statusLayout.ColumnCount = 1;
this.statusLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.statusLayout.Controls.Add(this.lblTituloStatus, 0, 0);
this.statusLayout.Controls.Add(this.rowOperacaoLiberada, 0, 1);
this.statusLayout.Controls.Add(this.rowMqtt, 0, 2);
this.statusLayout.Controls.Add(this.rowIA, 0, 3);
this.statusLayout.Controls.Add(this.rowFalhas, 0, 4);
this.statusLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusLayout.Location = new System.Drawing.Point(10, 7);
this.statusLayout.Margin = new System.Windows.Forms.Padding(0);
this.statusLayout.Name = "statusLayout";
this.statusLayout.RowCount = 5;
this.statusLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.statusLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.statusLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.statusLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.statusLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.statusLayout.Size = new System.Drawing.Size(233, 158);
this.statusLayout.TabIndex = 0;
//
// lblTituloStatus
//
this.lblTituloStatus.BackColor = System.Drawing.Color.Transparent;
this.lblTituloStatus.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTituloStatus.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold);
this.lblTituloStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(245)))), ((int)(((byte)(247)))));
this.lblTituloStatus.Location = new System.Drawing.Point(0, 0);
this.lblTituloStatus.Margin = new System.Windows.Forms.Padding(0);
this.lblTituloStatus.Name = "lblTituloStatus";
this.lblTituloStatus.Size = new System.Drawing.Size(233, 25);
this.lblTituloStatus.TabIndex = 0;
this.lblTituloStatus.Text = "▌ Status rápido";
this.lblTituloStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// rowOperacaoLiberada
//
this.rowOperacaoLiberada.BackColor = System.Drawing.Color.Transparent;
this.rowOperacaoLiberada.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(51)))), ((int)(((byte)(57)))));
this.rowOperacaoLiberada.Dock = System.Windows.Forms.DockStyle.Fill;
this.rowOperacaoLiberada.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(33)))), ((int)(((byte)(37)))));
this.rowOperacaoLiberada.Location = new System.Drawing.Point(0, 27);
this.rowOperacaoLiberada.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.rowOperacaoLiberada.MinimumSize = new System.Drawing.Size(120, 29);
this.rowOperacaoLiberada.Name = "rowOperacaoLiberada";
this.rowOperacaoLiberada.Size = new System.Drawing.Size(233, 29);
this.rowOperacaoLiberada.StatusColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(83)))), ((int)(((byte)(80)))));
this.rowOperacaoLiberada.TabIndex = 1;
this.rowOperacaoLiberada.Titulo = "Operação liberada";
this.rowOperacaoLiberada.Valor = "Não";
//
// rowMqtt
//
this.rowMqtt.BackColor = System.Drawing.Color.Transparent;
this.rowMqtt.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(51)))), ((int)(((byte)(57)))));
this.rowMqtt.Dock = System.Windows.Forms.DockStyle.Fill;
this.rowMqtt.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(33)))), ((int)(((byte)(37)))));
this.rowMqtt.Location = new System.Drawing.Point(0, 60);
this.rowMqtt.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.rowMqtt.MinimumSize = new System.Drawing.Size(120, 29);
this.rowMqtt.Name = "rowMqtt";
this.rowMqtt.Size = new System.Drawing.Size(233, 29);
this.rowMqtt.StatusColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(83)))), ((int)(((byte)(80)))));
this.rowMqtt.TabIndex = 2;
this.rowMqtt.Titulo = "MQTT / Base";
this.rowMqtt.Valor = "Desconectado";
//
// rowIA
//
this.rowIA.BackColor = System.Drawing.Color.Transparent;
this.rowIA.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(51)))), ((int)(((byte)(57)))));
this.rowIA.Dock = System.Windows.Forms.DockStyle.Fill;
this.rowIA.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(33)))), ((int)(((byte)(37)))));
this.rowIA.Location = new System.Drawing.Point(0, 93);
this.rowIA.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.rowIA.MinimumSize = new System.Drawing.Size(120, 29);
this.rowIA.Name = "rowIA";
this.rowIA.Size = new System.Drawing.Size(233, 29);
this.rowIA.StatusColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(83)))), ((int)(((byte)(80)))));
this.rowIA.TabIndex = 3;
this.rowIA.Titulo = "Inteligência artificial";
this.rowIA.Valor = "Desconectada";
//
// rowFalhas
//
this.rowFalhas.BackColor = System.Drawing.Color.Transparent;
this.rowFalhas.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(51)))), ((int)(((byte)(57)))));
this.rowFalhas.Cursor = System.Windows.Forms.Cursors.Hand;
this.rowFalhas.Dock = System.Windows.Forms.DockStyle.Fill;
this.rowFalhas.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(33)))), ((int)(((byte)(37)))));
this.rowFalhas.Location = new System.Drawing.Point(0, 126);
this.rowFalhas.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.rowFalhas.MinimumSize = new System.Drawing.Size(120, 29);
this.rowFalhas.Name = "rowFalhas";
this.rowFalhas.Size = new System.Drawing.Size(233, 30);
this.rowFalhas.StatusColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.rowFalhas.TabIndex = 4;
this.rowFalhas.Titulo = "Falhas ativas";
this.rowFalhas.Valor = "Nenhuma";
//
// pnlAtalhos
//
this.pnlAtalhos.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.pnlAtalhos.BackColor = System.Drawing.Color.Transparent;
this.pnlAtalhos.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.pnlAtalhos.Controls.Add(this.atalhosLayout);
this.pnlAtalhos.CornerRadius = 11;
this.pnlAtalhos.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlAtalhos.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(29)))), ((int)(((byte)(33)))));
this.pnlAtalhos.Location = new System.Drawing.Point(271, 5);
this.pnlAtalhos.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.pnlAtalhos.MinimumSize = new System.Drawing.Size(30, 30);
this.pnlAtalhos.Name = "pnlAtalhos";
this.pnlAtalhos.Padding = new System.Windows.Forms.Padding(10, 7, 10, 7);
this.pnlAtalhos.Size = new System.Drawing.Size(307, 172);
this.pnlAtalhos.TabIndex = 1;
//
// atalhosLayout
//
this.atalhosLayout.BackColor = System.Drawing.Color.Transparent;
this.atalhosLayout.ColumnCount = 1;
this.atalhosLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.atalhosLayout.Controls.Add(this.lblTituloAtalhos, 0, 0);
this.atalhosLayout.Controls.Add(this.btnDebugMode, 0, 1);
this.atalhosLayout.Controls.Add(this.btnAjustarLeverArm, 0, 2);
this.atalhosLayout.Controls.Add(this.btnSincronizarArquivos, 0, 3);
this.atalhosLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.atalhosLayout.Location = new System.Drawing.Point(10, 7);
this.atalhosLayout.Margin = new System.Windows.Forms.Padding(0);
this.atalhosLayout.Name = "atalhosLayout";
this.atalhosLayout.RowCount = 4;
this.atalhosLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.atalhosLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.atalhosLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.atalhosLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.atalhosLayout.Size = new System.Drawing.Size(287, 158);
this.atalhosLayout.TabIndex = 0;
//
// lblTituloAtalhos
//
this.lblTituloAtalhos.BackColor = System.Drawing.Color.Transparent;
this.lblTituloAtalhos.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTituloAtalhos.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold);
this.lblTituloAtalhos.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(245)))), ((int)(((byte)(247)))));
this.lblTituloAtalhos.Location = new System.Drawing.Point(0, 0);
this.lblTituloAtalhos.Margin = new System.Windows.Forms.Padding(0);
this.lblTituloAtalhos.Name = "lblTituloAtalhos";
this.lblTituloAtalhos.Size = new System.Drawing.Size(287, 25);
this.lblTituloAtalhos.TabIndex = 0;
this.lblTituloAtalhos.Text = "▌ Atalhos de campo";
this.lblTituloAtalhos.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnDebugMode
//
this.btnDebugMode.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.btnDebugMode.BackColor = System.Drawing.Color.Transparent;
this.btnDebugMode.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(51)))), ((int)(((byte)(57)))));
this.btnDebugMode.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDebugMode.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnDebugMode.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(33)))), ((int)(((byte)(37)))));
this.btnDebugMode.IconText = "↪";
this.btnDebugMode.Location = new System.Drawing.Point(0, 28);
this.btnDebugMode.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.btnDebugMode.MinimumSize = new System.Drawing.Size(140, 34);
this.btnDebugMode.Name = "btnDebugMode";
this.btnDebugMode.Size = new System.Drawing.Size(287, 38);
this.btnDebugMode.TabIndex = 1;
this.btnDebugMode.Texto = "Ligar Debug Mode";
//
// btnAjustarLeverArm
//
this.btnAjustarLeverArm.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.btnAjustarLeverArm.BackColor = System.Drawing.Color.Transparent;
this.btnAjustarLeverArm.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(51)))), ((int)(((byte)(57)))));
this.btnAjustarLeverArm.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAjustarLeverArm.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnAjustarLeverArm.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(33)))), ((int)(((byte)(37)))));
this.btnAjustarLeverArm.IconText = "↔";
this.btnAjustarLeverArm.Location = new System.Drawing.Point(0, 72);
this.btnAjustarLeverArm.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.btnAjustarLeverArm.MinimumSize = new System.Drawing.Size(140, 34);
this.btnAjustarLeverArm.Name = "btnAjustarLeverArm";
this.btnAjustarLeverArm.Size = new System.Drawing.Size(287, 38);
this.btnAjustarLeverArm.TabIndex = 2;
this.btnAjustarLeverArm.Texto = "Ajustar lever arm";
//
// btnSincronizarArquivos
//
this.btnSincronizarArquivos.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.btnSincronizarArquivos.BackColor = System.Drawing.Color.Transparent;
this.btnSincronizarArquivos.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(51)))), ((int)(((byte)(57)))));
this.btnSincronizarArquivos.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSincronizarArquivos.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnSincronizarArquivos.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(33)))), ((int)(((byte)(37)))));
this.btnSincronizarArquivos.IconText = "⇩";
this.btnSincronizarArquivos.Location = new System.Drawing.Point(0, 116);
this.btnSincronizarArquivos.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.btnSincronizarArquivos.MinimumSize = new System.Drawing.Size(140, 34);
this.btnSincronizarArquivos.Name = "btnSincronizarArquivos";
this.btnSincronizarArquivos.Size = new System.Drawing.Size(287, 39);
this.btnSincronizarArquivos.TabIndex = 3;
this.btnSincronizarArquivos.Texto = "Sincronizar arquivos";
//
// pnlAtualizacoes
//
this.pnlAtualizacoes.AccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(210)))), ((int)(((byte)(122)))));
this.pnlAtualizacoes.BackColor = System.Drawing.Color.Transparent;
this.pnlAtualizacoes.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(63)))), ((int)(((byte)(69)))));
this.pnlAtualizacoes.Controls.Add(this.atualizacaoLayout);
this.pnlAtualizacoes.CornerRadius = 11;
this.pnlAtualizacoes.Cursor = System.Windows.Forms.Cursors.Hand;
this.pnlAtualizacoes.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlAtualizacoes.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(29)))), ((int)(((byte)(33)))));
this.pnlAtualizacoes.Location = new System.Drawing.Point(590, 5);
this.pnlAtualizacoes.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.pnlAtualizacoes.MinimumSize = new System.Drawing.Size(30, 30);
this.pnlAtualizacoes.Name = "pnlAtualizacoes";
this.pnlAtualizacoes.Padding = new System.Windows.Forms.Padding(10, 7, 10, 7);
this.pnlAtualizacoes.Size = new System.Drawing.Size(184, 172);
this.pnlAtualizacoes.TabIndex = 2;
//
// atualizacaoLayout
//
this.atualizacaoLayout.BackColor = System.Drawing.Color.Transparent;
this.atualizacaoLayout.ColumnCount = 1;
this.atualizacaoLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.atualizacaoLayout.Controls.Add(this.lblTituloAtualizacoes, 0, 0);
this.atualizacaoLayout.Controls.Add(this.picWifi, 0, 1);
this.atualizacaoLayout.Controls.Add(this.lblAtualizacaoResumo, 0, 2);
this.atualizacaoLayout.Controls.Add(this.pgbAtualizacaoArquivos, 0, 3);
this.atualizacaoLayout.Controls.Add(this.lblProgressoAtualizacao, 0, 4);
this.atualizacaoLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.atualizacaoLayout.Location = new System.Drawing.Point(10, 7);
this.atualizacaoLayout.Margin = new System.Windows.Forms.Padding(0);
this.atualizacaoLayout.Name = "atualizacaoLayout";
this.atualizacaoLayout.RowCount = 5;
this.atualizacaoLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.atualizacaoLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.atualizacaoLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 24F));
this.atualizacaoLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 16F));
this.atualizacaoLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22F));
this.atualizacaoLayout.Size = new System.Drawing.Size(164, 158);
this.atualizacaoLayout.TabIndex = 0;
//
// lblTituloAtualizacoes
//
this.lblTituloAtualizacoes.BackColor = System.Drawing.Color.Transparent;
this.lblTituloAtualizacoes.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTituloAtualizacoes.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold);
this.lblTituloAtualizacoes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(245)))), ((int)(((byte)(247)))));
this.lblTituloAtualizacoes.Location = new System.Drawing.Point(0, 0);
this.lblTituloAtualizacoes.Margin = new System.Windows.Forms.Padding(0);
this.lblTituloAtualizacoes.Name = "lblTituloAtualizacoes";
this.lblTituloAtualizacoes.Size = new System.Drawing.Size(164, 25);
this.lblTituloAtualizacoes.TabIndex = 0;
this.lblTituloAtualizacoes.Text = "▌ Atualizações";
this.lblTituloAtualizacoes.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// picWifi
//
this.picWifi.Anchor = System.Windows.Forms.AnchorStyles.None;
this.picWifi.BackColor = System.Drawing.Color.Transparent;
this.picWifi.Cursor = System.Windows.Forms.Cursors.Hand;
this.picWifi.Image = global::AgroBase.Properties.Resources.wifi_off;
this.picWifi.Location = new System.Drawing.Point(55, 40);
this.picWifi.Margin = new System.Windows.Forms.Padding(0);
this.picWifi.Name = "picWifi";
this.picWifi.Size = new System.Drawing.Size(54, 41);
this.picWifi.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picWifi.TabIndex = 1;
this.picWifi.TabStop = false;
//
// lblAtualizacaoResumo
//
this.lblAtualizacaoResumo.AutoEllipsis = true;
this.lblAtualizacaoResumo.BackColor = System.Drawing.Color.Transparent;
this.lblAtualizacaoResumo.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblAtualizacaoResumo.Font = new System.Drawing.Font("Segoe UI", 8.5F, System.Drawing.FontStyle.Bold);
this.lblAtualizacaoResumo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(164)))), ((int)(((byte)(174)))), ((int)(((byte)(181)))));
this.lblAtualizacaoResumo.Location = new System.Drawing.Point(0, 96);
this.lblAtualizacaoResumo.Margin = new System.Windows.Forms.Padding(0);
this.lblAtualizacaoResumo.Name = "lblAtualizacaoResumo";
this.lblAtualizacaoResumo.Size = new System.Drawing.Size(164, 24);
this.lblAtualizacaoResumo.TabIndex = 2;
this.lblAtualizacaoResumo.Text = "Sem internet";
this.lblAtualizacaoResumo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pgbAtualizacaoArquivos
//
this.pgbAtualizacaoArquivos.Dock = System.Windows.Forms.DockStyle.Fill;
this.pgbAtualizacaoArquivos.Location = new System.Drawing.Point(5, 123);
this.pgbAtualizacaoArquivos.Margin = new System.Windows.Forms.Padding(5, 3, 5, 2);
this.pgbAtualizacaoArquivos.Name = "pgbAtualizacaoArquivos";
this.pgbAtualizacaoArquivos.Size = new System.Drawing.Size(154, 11);
this.pgbAtualizacaoArquivos.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.pgbAtualizacaoArquivos.TabIndex = 3;
//
// lblProgressoAtualizacao
//
this.lblProgressoAtualizacao.AutoEllipsis = true;
this.lblProgressoAtualizacao.BackColor = System.Drawing.Color.Transparent;
this.lblProgressoAtualizacao.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblProgressoAtualizacao.Font = new System.Drawing.Font("Segoe UI", 7.25F);
this.lblProgressoAtualizacao.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(164)))), ((int)(((byte)(174)))), ((int)(((byte)(181)))));
this.lblProgressoAtualizacao.Location = new System.Drawing.Point(0, 136);
this.lblProgressoAtualizacao.Margin = new System.Windows.Forms.Padding(0);
this.lblProgressoAtualizacao.Name = "lblProgressoAtualizacao";
this.lblProgressoAtualizacao.Size = new System.Drawing.Size(164, 22);
this.lblProgressoAtualizacao.TabIndex = 4;
this.lblProgressoAtualizacao.Text = "Toque para sincronizar";
this.lblProgressoAtualizacao.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pnlFooter
//
this.pnlFooter.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(21)))), ((int)(((byte)(25)))));
this.pnlFooter.Controls.Add(this.footerLayout);
this.pnlFooter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlFooter.Location = new System.Drawing.Point(10, 568);
this.pnlFooter.Margin = new System.Windows.Forms.Padding(0);
this.pnlFooter.Name = "pnlFooter";
this.pnlFooter.Size = new System.Drawing.Size(780, 25);
this.pnlFooter.TabIndex = 3;
//
// footerLayout
//
this.footerLayout.BackColor = System.Drawing.Color.Transparent;
this.footerLayout.ColumnCount = 2;
this.footerLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.footerLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.footerLayout.Controls.Add(this.lblVersao, 0, 0);
this.footerLayout.Controls.Add(this.lblConexaoFooter, 1, 0);
this.footerLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.footerLayout.Location = new System.Drawing.Point(0, 0);
this.footerLayout.Margin = new System.Windows.Forms.Padding(0);
this.footerLayout.Name = "footerLayout";
this.footerLayout.RowCount = 1;
this.footerLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.footerLayout.Size = new System.Drawing.Size(780, 25);
this.footerLayout.TabIndex = 0;
//
// lblVersao
//
this.lblVersao.BackColor = System.Drawing.Color.Transparent;
this.lblVersao.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblVersao.Font = new System.Drawing.Font("Segoe UI", 8F);
this.lblVersao.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(164)))), ((int)(((byte)(174)))), ((int)(((byte)(181)))));
this.lblVersao.Location = new System.Drawing.Point(8, 0);
this.lblVersao.Margin = new System.Windows.Forms.Padding(8, 0, 0, 0);
this.lblVersao.Name = "lblVersao";
this.lblVersao.Size = new System.Drawing.Size(382, 25);
this.lblVersao.TabIndex = 0;
this.lblVersao.Text = "● IHM Rover • v 0.0.0.0";
this.lblVersao.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblConexaoFooter
//
this.lblConexaoFooter.BackColor = System.Drawing.Color.Transparent;
this.lblConexaoFooter.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblConexaoFooter.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Bold);
this.lblConexaoFooter.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(83)))), ((int)(((byte)(80)))));
this.lblConexaoFooter.Location = new System.Drawing.Point(390, 0);
this.lblConexaoFooter.Margin = new System.Windows.Forms.Padding(0, 0, 8, 0);
this.lblConexaoFooter.Name = "lblConexaoFooter";
this.lblConexaoFooter.Size = new System.Drawing.Size(382, 25);
this.lblConexaoFooter.TabIndex = 1;
this.lblConexaoFooter.Text = "▮▮▮ Base desconectada";
this.lblConexaoFooter.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// frmMenu
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(12)))), ((int)(((byte)(17)))), ((int)(((byte)(20)))));
this.ClientSize = new System.Drawing.Size(800, 600);
this.Controls.Add(this.rootLayout);
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("Segoe UI", 9F);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "frmMenu";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Menu do Equipamento";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmIHMMenu_FormClosed);
this.Load += new System.EventHandler(this.frmIHMMenu_Load);
this.rootLayout.ResumeLayout(false);
this.pnlHeader.ResumeLayout(false);
this.headerLayout.ResumeLayout(false);
this.headerTextLayout.ResumeLayout(false);
this.pnlRoverStatus.ResumeLayout(false);
this.roverStatusLayout.ResumeLayout(false);
this.gridAcoes.ResumeLayout(false);
this.gridInferior.ResumeLayout(false);
this.pnlStatusRapido.ResumeLayout(false);
this.statusLayout.ResumeLayout(false);
this.pnlAtalhos.ResumeLayout(false);
this.atalhosLayout.ResumeLayout(false);
this.pnlAtualizacoes.ResumeLayout(false);
this.atualizacaoLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picWifi)).EndInit();
this.pnlFooter.ResumeLayout(false);
this.footerLayout.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel rootLayout;
private AgroBase.Forms.IHM.Controls.HmiRoundedPanel pnlHeader;
private System.Windows.Forms.TableLayoutPanel headerLayout;
private System.Windows.Forms.TableLayoutPanel headerTextLayout;
private System.Windows.Forms.Label lblTitulo;
public System.Windows.Forms.Label lblStatus;
private AgroBase.Forms.IHM.Controls.HmiRoundedPanel pnlRoverStatus;
private System.Windows.Forms.TableLayoutPanel roverStatusLayout;
private System.Windows.Forms.Label lblRoverDot;
private System.Windows.Forms.Label lblRoverNome;
private System.Windows.Forms.Label lblRoverProntidao;
private System.Windows.Forms.TableLayoutPanel gridAcoes;
private AgroBase.Forms.IHM.Controls.HmiMenuTile tileOperacao;
private AgroBase.Forms.IHM.Controls.HmiMenuTile tileModoManual;
private AgroBase.Forms.IHM.Controls.HmiMenuTile tileDiagnosticos;
private AgroBase.Forms.IHM.Controls.HmiMenuTile tileAjustes;
private AgroBase.Forms.IHM.Controls.HmiMenuTile tileTestes;
private AgroBase.Forms.IHM.Controls.HmiMenuTile tileDesligar;
private System.Windows.Forms.TableLayoutPanel gridInferior;
private AgroBase.Forms.IHM.Controls.HmiRoundedPanel pnlStatusRapido;
private System.Windows.Forms.TableLayoutPanel statusLayout;
private System.Windows.Forms.Label lblTituloStatus;
private AgroBase.Forms.IHM.Controls.HmiStatusRow rowOperacaoLiberada;
private AgroBase.Forms.IHM.Controls.HmiStatusRow rowMqtt;
private AgroBase.Forms.IHM.Controls.HmiStatusRow rowIA;
private AgroBase.Forms.IHM.Controls.HmiStatusRow rowFalhas;
private AgroBase.Forms.IHM.Controls.HmiRoundedPanel pnlAtalhos;
private System.Windows.Forms.TableLayoutPanel atalhosLayout;
private System.Windows.Forms.Label lblTituloAtalhos;
private AgroBase.Forms.IHM.Controls.HmiShortcutButton btnDebugMode;
private AgroBase.Forms.IHM.Controls.HmiShortcutButton btnAjustarLeverArm;
private AgroBase.Forms.IHM.Controls.HmiShortcutButton btnSincronizarArquivos;
private AgroBase.Forms.IHM.Controls.HmiRoundedPanel pnlAtualizacoes;
private System.Windows.Forms.TableLayoutPanel atualizacaoLayout;
private System.Windows.Forms.Label lblTituloAtualizacoes;
private System.Windows.Forms.PictureBox picWifi;
private System.Windows.Forms.Label lblAtualizacaoResumo;
public System.Windows.Forms.ProgressBar pgbAtualizacaoArquivos;
public System.Windows.Forms.Label lblProgressoAtualizacao;
private System.Windows.Forms.Panel pnlFooter;
private System.Windows.Forms.TableLayoutPanel footerLayout;
public System.Windows.Forms.Label lblVersao;
private System.Windows.Forms.Label lblConexaoFooter;
}
}

View File

@ -0,0 +1,409 @@
using AgroBase.Forms.IHM.Controls;
using AgroBase.Models;
using AgroBase.Models.Components;
using AgroBase.Properties;
using AgroBase.Services;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using static AgroBase.Models.Enums;
namespace AgroBase.Forms.IHM
{
public partial class frmMenu : Form
{
private bool _sincronizando;
/// <summary>
/// Estes eventos deixam os atalhos de campo prontos para receber
/// a implementação real sem precisar alterar o componente visual.
/// </summary>
public event EventHandler AjustarLeverArmSolicitado;
public event EventHandler<TelaSolicitadaEventArgs> TelaSolicitada;
public frmMenu()
{
InitializeComponent();
VincularAcaoAsync(tileOperacao, "Erro ao carregar operação!", AbrirOperacaoAsync);
VincularAcaoAsync(tileModoManual, "Erro ao carregar modo de controle manual!", AbrirModoManualAsync);
VincularAcaoAsync(tileDiagnosticos, "Erro ao processar diagnósticos!", AbrirDiagnosticoAsync);
VincularAcaoAsync(tileAjustes, "Erro ao realizar ajustes!", AbrirAjustesAsync);
VincularAcaoAsync(tileTestes, "Erro ao processar testes!", AbrirTestesAsync);
VincularAcaoAsync(tileDesligar, "Erro ao desligar equipamento!", DesligarEquipamentoAsync);
VincularAcaoAsync(btnSincronizarArquivos, "Erro ao procurar por atualizações!", ProcurarAtualizacoesAsync);
VincularAcaoAsync(pnlAtualizacoes, "Erro ao procurar por atualizações!", ProcurarAtualizacoesAsync);
VincularCliqueRecursivo(
pnlAtualizacoes,
async delegate
{
await ExecutarAcaoSeguraAsync(
"Erro ao procurar por atualizações!",
ProcurarAtualizacoesAsync);
});
btnDebugMode.Click += BtnDebugMode_Click;
btnAjustarLeverArm.Click += BtnAjustarLeverArm_Click;
rowFalhas.Click += LblCodigoFalha_Click;
}
private void frmIHMMenu_Load(object sender, EventArgs e)
{
lblVersao.Text = "● IHM Rover • v " + Variaveis.Versao;
AtualizarControlesUI();
}
private void frmIHMMenu_FormClosed(object sender, FormClosedEventArgs e)
{
}
public void AtualizarControlesUI()
{
bool mqttConectado = Variaveis.MqttServiceLocal != null && Variaveis.MqttServiceLocal.StatusConexao();
bool iaConectada = VariaveisOperacao.Operadores != null && VariaveisOperacao.Operadores.Conectado;
var operacao = Variaveis.OperacaoEmAndamento;
bool operacaoLiberada = operacao?.Sensoriamento?.Operacao?.OperacaoLiberada == true;
string erroOperacao = operacao?.Sensoriamento?.Operacao?.ErroOperacaoLiberada;
bool existeFalha = !string.IsNullOrWhiteSpace(erroOperacao);
bool internetDisponivel = APIService.HasInternet;
bool baseConectada = VariaveisOperacao.PosicaoBase?.Inicializado ?? false;
btnDebugMode.Texto = Variaveis.DebugMode ? "Desligar Debug Mode" : "Ligar Debug Mode";
rowOperacaoLiberada.SetStatus(operacaoLiberada ? "Sim" : "Não", operacaoLiberada ? HmiTheme.Success : HmiTheme.Danger);
rowMqtt.SetStatus(mqttConectado ? "Conectado" : "Desconectado", mqttConectado ? HmiTheme.Success : HmiTheme.Danger);
rowIA.SetStatus(iaConectada ? "Conectada" : "Desconectada", iaConectada ? HmiTheme.Success : HmiTheme.Danger);
rowFalhas.SetStatus(existeFalha ? "Ver detalhes" : "Nenhuma", existeFalha ? HmiTheme.Warning : HmiTheme.Success);
tileOperacao.SetStatus(operacaoLiberada ? "Pronta para iniciar" : "Aguardando liberação", operacaoLiberada ? HmiTheme.Success : HmiTheme.Warning);
tileDiagnosticos.SetStatus(existeFalha ? "Existe uma falha ativa" : "Saúde geral normal", existeFalha ? HmiTheme.Warning : HmiTheme.Info);
tileDiagnosticos.AccentColor = existeFalha ? HmiTheme.Warning : HmiTheme.Info;
bool pronto = operacaoLiberada && mqttConectado && iaConectada;
lblRoverProntidao.Text = pronto ? "Pronto para operação" : "Aguardando condições";
lblRoverProntidao.ForeColor = pronto ? HmiTheme.Success : HmiTheme.Warning;
lblRoverDot.ForeColor = pronto ? HmiTheme.Success : HmiTheme.Warning;
lblConexaoFooter.Text = baseConectada ? "▮▮▮ Base conectada" : "▯▯▯ Base desconectada";
lblConexaoFooter.ForeColor = baseConectada ? HmiTheme.Success : HmiTheme.Danger;
picWifi.Image = internetDisponivel ? Resources.wifi_on : Resources.wifi_off;
lblStatus.Text = SerialService.LastUIMessage;
if (!_sincronizando)
{
lblAtualizacaoResumo.Text = internetDisponivel ? "Internet disponível" : "Sem internet";
lblAtualizacaoResumo.ForeColor = internetDisponivel ? HmiTheme.Success : HmiTheme.Danger;
if (pgbAtualizacaoArquivos.Value == 0)
{
lblProgressoAtualizacao.Text = internetDisponivel ? "Toque para sincronizar" : "Conecte o equipamento";
}
}
}
public void AtualizarProgressoSyncArquivos(string msg, double val)
{
BeginInvoke((MethodInvoker)(() =>
{
try
{
lblProgressoAtualizacao.Text = msg;
FuncoesGlobais.PreencheValorProgressBar(pgbAtualizacaoArquivos, val);
}
catch { }
}));
}
private Task AbrirAjustesAsync()
{
TelaSolicitada?.Invoke(this, new TelaSolicitadaEventArgs(TipoTelaIHM.Ajustes));
return Task.CompletedTask;
}
private Task AbrirDiagnosticoAsync()
{
TelaSolicitada?.Invoke(this, new TelaSolicitadaEventArgs(TipoTelaIHM.Diagnostico));
return Task.CompletedTask;
}
private Task AbrirOperacaoAsync()
{
TelaSolicitada?.Invoke(this, new TelaSolicitadaEventArgs(TipoTelaIHM.Operacao));
return Task.CompletedTask;
}
private Task AbrirTestesAsync()
{
TelaSolicitada?.Invoke(this, new TelaSolicitadaEventArgs(TipoTelaIHM.Testes));
return Task.CompletedTask;
}
private async Task AbrirModoManualAsync()
{
Variaveis.OperacaoEmAndamento = OperacaoModel.CarregarParametrosOperacaoPadrao(ModoOperacao.Manual, CarregarModulos: true);
var op = Variaveis.OperacaoEmAndamento;
bool operacaoLiberada = op?.Sensoriamento?.Operacao?.OperacaoLiberada == true;
if (operacaoLiberada)
{
var frm = new frmDialogoMapa();
frm.Show();
frm.InicializarModoManual();
}
else
{
string erro = op?.Sensoriamento?.Operacao?.ErroOperacaoLiberada ?? "Não foi possível liberar a operação manual.";
CustomDialog.ShowDialog(
"Iniciar Operação Manual",
erro ?? string.Empty,
MessageBoxIcon.Error,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), delegate { } }
});
}
await Task.CompletedTask;
}
private async Task DesligarEquipamentoAsync()
{
if (Variaveis.UsarIHM)
{
var resultado = CustomDialog.ShowDialog(
"Desligar",
"Deseja desligar o equipamento?",
MessageBoxIcon.Question,
new Dictionary<(string, DialogResult?), Action>()
{
{ ("Sim", DialogResult.Yes), delegate { } },
{ ("Não", DialogResult.No), delegate { } }
});
if (resultado == DialogResult.Yes)
{
frmInstancial.frmIHM.Close();
if (Variaveis.Producao)
Process.Start("shutdown", "/s /t 0");
}
}
else
{
Close();
}
await Task.CompletedTask;
}
private async Task ProcurarAtualizacoesAsync()
{
if (_sincronizando)
return;
if (!APIService.HasInternet)
{
CustomDialog.ShowDialog(
"Equipamento Desconectado",
"Impossível procurar por atualizações.",
MessageBoxIcon.Warning,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), delegate { } }
});
return;
}
_sincronizando = true;
lblAtualizacaoResumo.Text = "Sincronizando...";
lblAtualizacaoResumo.ForeColor = HmiTheme.Info;
lblProgressoAtualizacao.Text = "Procurando arquivos...";
btnSincronizarArquivos.Enabled = false;
try
{
await VersionamentoService.AtualizarArquivoVersionamento(true);
var arquivosNaoEncontrados =
VersionamentoService.ArquivosNaoEncontrados.ToList();
bool sucesso = !arquivosNaoEncontrados.Any();
lblAtualizacaoResumo.Text =
sucesso
? "Sem pendências"
: "Atualização incompleta";
lblAtualizacaoResumo.ForeColor =
sucesso
? HmiTheme.Success
: HmiTheme.Warning;
lblProgressoAtualizacao.Text =
sucesso
? "Sincronização concluída"
: "Verifique os arquivos pendentes";
CustomDialog.ShowDialog(
"Resultado",
"Atualização concluída com " +
(sucesso ? "sucesso" : "falha") +
"!\r\n\r\n" +
(!sucesso
? "Arquivos não encontrados:\r\n\r\n" +
string.Join("\r\n", arquivosNaoEncontrados)
: "Nenhum arquivo pendente!"),
sucesso
? MessageBoxIcon.Asterisk
: MessageBoxIcon.Error,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), delegate { } }
});
}
finally
{
_sincronizando = false;
btnSincronizarArquivos.Enabled = true;
AtualizarControlesUI();
}
}
private void BtnDebugMode_Click(object sender, EventArgs e)
{
Variaveis.DebugMode = !Variaveis.DebugMode;
btnDebugMode.Texto = Variaveis.DebugMode ? "Desligar Debug Mode" : "Ligar Debug Mode";
}
private void BtnAjustarLeverArm_Click(object sender, EventArgs e)
{
if (AjustarLeverArmSolicitado != null)
{
AjustarLeverArmSolicitado(this, EventArgs.Empty);
return;
}
ExibirAtalhoNaoVinculado(
"Ajustar Lever Arm",
"O layout já está pronto. Vincule a tela ou o diálogo no evento " +
"AjustarLeverArmSolicitado.");
}
private void LblCodigoFalha_Click(object sender, EventArgs e)
{
var operacao = Variaveis.OperacaoEmAndamento;
string descricaoFalha = operacao?.Sensoriamento?.Operacao?.ErroOperacaoLiberada;
if (string.IsNullOrWhiteSpace(descricaoFalha))
descricaoFalha = "Nenhuma falha ativa.";
CustomDialog.ShowDialog(
"Detalhes da Operação",
descricaoFalha,
MessageBoxIcon.Information,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), delegate { } }
});
}
private void ExibirAtalhoNaoVinculado(string titulo, string mensagem)
{
CustomDialog.ShowDialog(
titulo,
mensagem,
MessageBoxIcon.Information,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), delegate { } }
});
}
private void VincularAcaoAsync(Control control, string mensagemErro, Func<Task> acao)
{
control.Click += async delegate
{
await ExecutarAcaoSeguraAsync(
mensagemErro,
acao);
};
}
private async Task ExecutarAcaoSeguraAsync(string mensagemErro, Func<Task> acao)
{
try
{
await acao();
}
catch (Exception ex)
{
CustomDialog.ShowDialog(
"Erro",
mensagemErro + "\r\n\r\n" + ex.Message,
MessageBoxIcon.Error,
new Dictionary<(string, dynamic), Action>()
{
{ ("OK", null), delegate { } }
});
}
}
private void VincularCliqueRecursivo(Control control, Func<Task> acao)
{
foreach (Control filho in control.Controls)
{
filho.Cursor = Cursors.Hand;
filho.Click += async delegate
{
await acao();
};
if (filho.HasChildren)
VincularCliqueRecursivo(filho, acao);
}
}
}
public enum TipoTelaIHM
{
Menu,
Operacao,
Ajustes,
Diagnostico,
Testes
}
public class TelaSolicitadaEventArgs : EventArgs
{
public TipoTelaIHM Tela { get; private set; }
public TelaSolicitadaEventArgs(TipoTelaIHM tela)
{
Tela = tela;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,459 @@
namespace AgroBase.Forms.IHM
{
partial class frmTestes
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmTestes));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPulverizador = new System.Windows.Forms.TabPage();
this.dgPulverizador = new System.Windows.Forms.DataGridView();
this.tabMovimentacao = new System.Windows.Forms.TabPage();
this.dgMovimentacao = new System.Windows.Forms.DataGridView();
this.tabDirecional = new System.Windows.Forms.TabPage();
this.dgDirecional = new System.Windows.Forms.DataGridView();
this.tabSensoriamento = new System.Windows.Forms.TabPage();
this.dgSensoriamento = new System.Windows.Forms.DataGridView();
this.tabComunicacao = new System.Windows.Forms.TabPage();
this.dgComunicacao = new System.Windows.Forms.DataGridView();
this.tabCameras = new System.Windows.Forms.TabPage();
this.dgCameras = new System.Windows.Forms.DataGridView();
this.tabSinaleiros = new System.Windows.Forms.TabPage();
this.dgSinaleiros = new System.Windows.Forms.DataGridView();
this.tabResultados = new System.Windows.Forms.TabPage();
this.dgResultados = new System.Windows.Forms.DataGridView();
this.tabFalhas = new System.Windows.Forms.TabPage();
this.tvwFalhas = new System.Windows.Forms.TreeView();
this.picCamera = new System.Windows.Forms.PictureBox();
this.picVoltar = new System.Windows.Forms.PictureBox();
this.picDiagnosticarTudo = new System.Windows.Forms.PictureBox();
this.picIniciarDiagnostico = new System.Windows.Forms.PictureBox();
this.picLoading = new System.Windows.Forms.PictureBox();
this.tabReles = new System.Windows.Forms.TabPage();
this.dgReles = new System.Windows.Forms.DataGridView();
this.tabControl1.SuspendLayout();
this.tabPulverizador.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgPulverizador)).BeginInit();
this.tabMovimentacao.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgMovimentacao)).BeginInit();
this.tabDirecional.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgDirecional)).BeginInit();
this.tabSensoriamento.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgSensoriamento)).BeginInit();
this.tabComunicacao.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgComunicacao)).BeginInit();
this.tabCameras.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgCameras)).BeginInit();
this.tabSinaleiros.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgSinaleiros)).BeginInit();
this.tabResultados.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgResultados)).BeginInit();
this.tabFalhas.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCamera)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picVoltar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picDiagnosticarTudo)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picIniciarDiagnostico)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picLoading)).BeginInit();
this.tabReles.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgReles)).BeginInit();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPulverizador);
this.tabControl1.Controls.Add(this.tabMovimentacao);
this.tabControl1.Controls.Add(this.tabDirecional);
this.tabControl1.Controls.Add(this.tabSensoriamento);
this.tabControl1.Controls.Add(this.tabComunicacao);
this.tabControl1.Controls.Add(this.tabCameras);
this.tabControl1.Controls.Add(this.tabSinaleiros);
this.tabControl1.Controls.Add(this.tabReles);
this.tabControl1.Controls.Add(this.tabResultados);
this.tabControl1.Controls.Add(this.tabFalhas);
this.tabControl1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabControl1.Location = new System.Drawing.Point(100, 12);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(912, 576);
this.tabControl1.TabIndex = 0;
//
// tabPulverizador
//
this.tabPulverizador.Controls.Add(this.dgPulverizador);
this.tabPulverizador.Location = new System.Drawing.Point(4, 38);
this.tabPulverizador.Name = "tabPulverizador";
this.tabPulverizador.Padding = new System.Windows.Forms.Padding(3);
this.tabPulverizador.Size = new System.Drawing.Size(904, 534);
this.tabPulverizador.TabIndex = 0;
this.tabPulverizador.Text = "Pulverizador";
this.tabPulverizador.UseVisualStyleBackColor = true;
//
// dgPulverizador
//
this.dgPulverizador.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgPulverizador.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgPulverizador.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgPulverizador.Location = new System.Drawing.Point(6, 6);
this.dgPulverizador.Name = "dgPulverizador";
this.dgPulverizador.Size = new System.Drawing.Size(892, 520);
this.dgPulverizador.TabIndex = 0;
//
// tabMovimentacao
//
this.tabMovimentacao.Controls.Add(this.dgMovimentacao);
this.tabMovimentacao.Location = new System.Drawing.Point(4, 38);
this.tabMovimentacao.Name = "tabMovimentacao";
this.tabMovimentacao.Padding = new System.Windows.Forms.Padding(3);
this.tabMovimentacao.Size = new System.Drawing.Size(904, 534);
this.tabMovimentacao.TabIndex = 1;
this.tabMovimentacao.Text = "Movimentação";
this.tabMovimentacao.UseVisualStyleBackColor = true;
//
// dgMovimentacao
//
this.dgMovimentacao.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgMovimentacao.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgMovimentacao.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgMovimentacao.Location = new System.Drawing.Point(6, 6);
this.dgMovimentacao.Name = "dgMovimentacao";
this.dgMovimentacao.Size = new System.Drawing.Size(892, 522);
this.dgMovimentacao.TabIndex = 1;
//
// tabDirecional
//
this.tabDirecional.Controls.Add(this.dgDirecional);
this.tabDirecional.Location = new System.Drawing.Point(4, 38);
this.tabDirecional.Name = "tabDirecional";
this.tabDirecional.Padding = new System.Windows.Forms.Padding(3);
this.tabDirecional.Size = new System.Drawing.Size(904, 534);
this.tabDirecional.TabIndex = 2;
this.tabDirecional.Text = "Direcional";
this.tabDirecional.UseVisualStyleBackColor = true;
//
// dgDirecional
//
this.dgDirecional.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgDirecional.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgDirecional.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgDirecional.Location = new System.Drawing.Point(6, 6);
this.dgDirecional.Name = "dgDirecional";
this.dgDirecional.Size = new System.Drawing.Size(892, 522);
this.dgDirecional.TabIndex = 2;
//
// tabSensoriamento
//
this.tabSensoriamento.Controls.Add(this.dgSensoriamento);
this.tabSensoriamento.Location = new System.Drawing.Point(4, 38);
this.tabSensoriamento.Name = "tabSensoriamento";
this.tabSensoriamento.Padding = new System.Windows.Forms.Padding(3);
this.tabSensoriamento.Size = new System.Drawing.Size(904, 534);
this.tabSensoriamento.TabIndex = 3;
this.tabSensoriamento.Text = "Sensoriamento";
this.tabSensoriamento.UseVisualStyleBackColor = true;
//
// dgSensoriamento
//
this.dgSensoriamento.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgSensoriamento.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgSensoriamento.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgSensoriamento.Location = new System.Drawing.Point(6, 6);
this.dgSensoriamento.Name = "dgSensoriamento";
this.dgSensoriamento.Size = new System.Drawing.Size(892, 522);
this.dgSensoriamento.TabIndex = 3;
//
// tabComunicacao
//
this.tabComunicacao.Controls.Add(this.dgComunicacao);
this.tabComunicacao.Location = new System.Drawing.Point(4, 38);
this.tabComunicacao.Name = "tabComunicacao";
this.tabComunicacao.Padding = new System.Windows.Forms.Padding(3);
this.tabComunicacao.Size = new System.Drawing.Size(904, 534);
this.tabComunicacao.TabIndex = 4;
this.tabComunicacao.Text = "Comunicação";
this.tabComunicacao.UseVisualStyleBackColor = true;
//
// dgComunicacao
//
this.dgComunicacao.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgComunicacao.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgComunicacao.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgComunicacao.Location = new System.Drawing.Point(6, 6);
this.dgComunicacao.Name = "dgComunicacao";
this.dgComunicacao.Size = new System.Drawing.Size(892, 522);
this.dgComunicacao.TabIndex = 4;
//
// tabCameras
//
this.tabCameras.Controls.Add(this.dgCameras);
this.tabCameras.Location = new System.Drawing.Point(4, 38);
this.tabCameras.Name = "tabCameras";
this.tabCameras.Padding = new System.Windows.Forms.Padding(3);
this.tabCameras.Size = new System.Drawing.Size(904, 534);
this.tabCameras.TabIndex = 5;
this.tabCameras.Text = "Câmeras";
this.tabCameras.UseVisualStyleBackColor = true;
//
// dgCameras
//
this.dgCameras.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgCameras.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgCameras.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgCameras.Location = new System.Drawing.Point(6, 6);
this.dgCameras.Name = "dgCameras";
this.dgCameras.Size = new System.Drawing.Size(892, 522);
this.dgCameras.TabIndex = 5;
//
// tabSinaleiros
//
this.tabSinaleiros.Controls.Add(this.dgSinaleiros);
this.tabSinaleiros.Location = new System.Drawing.Point(4, 38);
this.tabSinaleiros.Name = "tabSinaleiros";
this.tabSinaleiros.Padding = new System.Windows.Forms.Padding(3);
this.tabSinaleiros.Size = new System.Drawing.Size(904, 534);
this.tabSinaleiros.TabIndex = 6;
this.tabSinaleiros.Text = "Sinaleiros";
this.tabSinaleiros.UseVisualStyleBackColor = true;
//
// dgSinaleiros
//
this.dgSinaleiros.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgSinaleiros.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgSinaleiros.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgSinaleiros.Location = new System.Drawing.Point(6, 6);
this.dgSinaleiros.Name = "dgSinaleiros";
this.dgSinaleiros.Size = new System.Drawing.Size(892, 522);
this.dgSinaleiros.TabIndex = 6;
//
// tabResultados
//
this.tabResultados.Controls.Add(this.dgResultados);
this.tabResultados.Location = new System.Drawing.Point(4, 38);
this.tabResultados.Name = "tabResultados";
this.tabResultados.Padding = new System.Windows.Forms.Padding(3);
this.tabResultados.Size = new System.Drawing.Size(904, 534);
this.tabResultados.TabIndex = 7;
this.tabResultados.Text = "Resultados";
this.tabResultados.UseVisualStyleBackColor = true;
//
// dgResultados
//
this.dgResultados.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgResultados.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgResultados.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgResultados.Location = new System.Drawing.Point(6, 6);
this.dgResultados.Name = "dgResultados";
this.dgResultados.Size = new System.Drawing.Size(892, 522);
this.dgResultados.TabIndex = 7;
//
// tabFalhas
//
this.tabFalhas.Controls.Add(this.tvwFalhas);
this.tabFalhas.Location = new System.Drawing.Point(4, 38);
this.tabFalhas.Name = "tabFalhas";
this.tabFalhas.Padding = new System.Windows.Forms.Padding(3);
this.tabFalhas.Size = new System.Drawing.Size(904, 534);
this.tabFalhas.TabIndex = 8;
this.tabFalhas.Text = "Cód. Falhas";
this.tabFalhas.UseVisualStyleBackColor = true;
//
// tvwFalhas
//
this.tvwFalhas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tvwFalhas.Location = new System.Drawing.Point(6, 6);
this.tvwFalhas.Name = "tvwFalhas";
this.tvwFalhas.Size = new System.Drawing.Size(892, 522);
this.tvwFalhas.TabIndex = 0;
//
// picCamera
//
this.picCamera.Location = new System.Drawing.Point(12, 194);
this.picCamera.Name = "picCamera";
this.picCamera.Size = new System.Drawing.Size(65, 65);
this.picCamera.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picCamera.TabIndex = 6;
this.picCamera.TabStop = false;
//
// picVoltar
//
this.picVoltar.Image = global::AgroBase.Properties.Resources.voltar;
this.picVoltar.Location = new System.Drawing.Point(12, 12);
this.picVoltar.Name = "picVoltar";
this.picVoltar.Size = new System.Drawing.Size(65, 65);
this.picVoltar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picVoltar.TabIndex = 12;
this.picVoltar.TabStop = false;
//
// picDiagnosticarTudo
//
this.picDiagnosticarTudo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.picDiagnosticarTudo.Image = global::AgroBase.Properties.Resources.diagnostico;
this.picDiagnosticarTudo.Location = new System.Drawing.Point(12, 519);
this.picDiagnosticarTudo.Name = "picDiagnosticarTudo";
this.picDiagnosticarTudo.Size = new System.Drawing.Size(65, 65);
this.picDiagnosticarTudo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picDiagnosticarTudo.TabIndex = 13;
this.picDiagnosticarTudo.TabStop = false;
//
// picIniciarDiagnostico
//
this.picIniciarDiagnostico.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.picIniciarDiagnostico.Image = global::AgroBase.Properties.Resources.iniciar;
this.picIniciarDiagnostico.Location = new System.Drawing.Point(12, 425);
this.picIniciarDiagnostico.Name = "picIniciarDiagnostico";
this.picIniciarDiagnostico.Size = new System.Drawing.Size(65, 65);
this.picIniciarDiagnostico.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picIniciarDiagnostico.TabIndex = 14;
this.picIniciarDiagnostico.TabStop = false;
//
// picLoading
//
this.picLoading.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.picLoading.Location = new System.Drawing.Point(12, 328);
this.picLoading.Name = "picLoading";
this.picLoading.Size = new System.Drawing.Size(65, 65);
this.picLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picLoading.TabIndex = 15;
this.picLoading.TabStop = false;
//
// tabReles
//
this.tabReles.Controls.Add(this.dgReles);
this.tabReles.Location = new System.Drawing.Point(4, 38);
this.tabReles.Name = "tabReles";
this.tabReles.Padding = new System.Windows.Forms.Padding(3);
this.tabReles.Size = new System.Drawing.Size(904, 534);
this.tabReles.TabIndex = 9;
this.tabReles.Text = "Reles";
this.tabReles.UseVisualStyleBackColor = true;
//
// dgReles
//
this.dgReles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgReles.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgReles.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgReles.Location = new System.Drawing.Point(6, 6);
this.dgReles.Name = "dgReles";
this.dgReles.Size = new System.Drawing.Size(892, 522);
this.dgReles.TabIndex = 7;
//
// frmDiagnosticos
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1024, 600);
this.Controls.Add(this.picCamera);
this.Controls.Add(this.picLoading);
this.Controls.Add(this.picIniciarDiagnostico);
this.Controls.Add(this.picDiagnosticarTudo);
this.Controls.Add(this.picVoltar);
this.Controls.Add(this.tabControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmDiagnosticos";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Diagnósticos";
this.TopMost = true;
this.Load += new System.EventHandler(this.frmDiagnosticos_Load);
this.tabControl1.ResumeLayout(false);
this.tabPulverizador.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgPulverizador)).EndInit();
this.tabMovimentacao.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgMovimentacao)).EndInit();
this.tabDirecional.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgDirecional)).EndInit();
this.tabSensoriamento.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgSensoriamento)).EndInit();
this.tabComunicacao.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgComunicacao)).EndInit();
this.tabCameras.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgCameras)).EndInit();
this.tabSinaleiros.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgSinaleiros)).EndInit();
this.tabResultados.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgResultados)).EndInit();
this.tabFalhas.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picCamera)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picVoltar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picDiagnosticarTudo)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picIniciarDiagnostico)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picLoading)).EndInit();
this.tabReles.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgReles)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPulverizador;
private System.Windows.Forms.TabPage tabMovimentacao;
private System.Windows.Forms.TabPage tabDirecional;
private System.Windows.Forms.TabPage tabSensoriamento;
private System.Windows.Forms.TabPage tabComunicacao;
private System.Windows.Forms.TabPage tabCameras;
private System.Windows.Forms.TabPage tabSinaleiros;
private System.Windows.Forms.PictureBox picVoltar;
private System.Windows.Forms.TabPage tabResultados;
private System.Windows.Forms.PictureBox picDiagnosticarTudo;
private System.Windows.Forms.DataGridView dgPulverizador;
private System.Windows.Forms.PictureBox picIniciarDiagnostico;
private System.Windows.Forms.DataGridView dgMovimentacao;
private System.Windows.Forms.DataGridView dgDirecional;
private System.Windows.Forms.DataGridView dgSensoriamento;
private System.Windows.Forms.DataGridView dgComunicacao;
private System.Windows.Forms.DataGridView dgCameras;
private System.Windows.Forms.DataGridView dgSinaleiros;
private System.Windows.Forms.DataGridView dgResultados;
private System.Windows.Forms.PictureBox picCamera;
private System.Windows.Forms.PictureBox picLoading;
private System.Windows.Forms.TabPage tabFalhas;
private System.Windows.Forms.TreeView tvwFalhas;
private System.Windows.Forms.TabPage tabReles;
private System.Windows.Forms.DataGridView dgReles;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -372,7 +372,7 @@ namespace AgroBase.Forms
velocidadeMs,
tempoGps,
anguloAtual,
VariaveisEquipamento.DistanciaEntreEixos
VariaveisEquipamento.DistanciaEntreEixosCm
);
// Atualiza a interface gráfica

View File

@ -18,7 +18,7 @@ namespace AgroBase.Forms
{
FormBorderStyle = FormBorderStyle.None,
//WindowState = FormWindowState.Maximized,
//TopMost = true
TopMost = true
};
private static readonly SemaphoreSlim _startupGate = new SemaphoreSlim(1, 1);
@ -67,7 +67,14 @@ namespace AgroBase.Forms
{
try
{
if (!Variaveis.Producao)
if (Variaveis.UsarIHM)
{
frmIHM.FormClosing -= frmPrincipal_FormClosing;
frmIHM.FormClosing += frmPrincipal_FormClosing;
frmIHM.Show();
}
else
{
frmIHM.FormClosing -= FrmIHM_FormClosing;
frmPrincipal.FormClosing -= frmPrincipal_FormClosing;
@ -77,13 +84,6 @@ namespace AgroBase.Forms
frmPrincipal.Show();
}
else
{
frmIHM.FormClosing -= frmPrincipal_FormClosing;
frmIHM.FormClosing += frmPrincipal_FormClosing;
frmIHM.Show();
}
Hide();
}
@ -400,8 +400,8 @@ namespace AgroBase.Forms
* Em produção, o evento de fechamento da IHM é associado ao
* frmPrincipal_FormClosing e faz shutdown real.
*/
e.Cancel = true;
frmIHM.Hide();
//e.Cancel = true;
//frmIHM.Hide();
}
}
}

View File

@ -201,6 +201,18 @@ namespace AgroBase
await VersionamentoService.AtualizarArquivoVersionamento(true);
}
public void AtualizarProgressoSyncArquivos(string msg, double val)
{
BeginInvoke((MethodInvoker)(() =>
{
try
{
lblProgressoAtualizacao.Text = msg;
FuncoesGlobais.PreencheValorProgressBar(pgbAtualizacaoArquivos, val);
}
catch { }
}));
}
#endregion

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 986 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 986 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 686 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 674 KiB

File diff suppressed because it is too large Load Diff

View File

@ -79,7 +79,7 @@ public class MPCController
.ToList(),
horizonte = Horizonte,
angulo_max_graus = pControle.DirAnguloMaximo,
distancia_entre_eixos = (VariaveisEquipamento.DistanciaEntreEixos / 100.0),
distancia_entre_eixos = (VariaveisEquipamento.DistanciaEntreEixosCm / 100.0),
velocidade_min = FuncoesMatematicas.CalculaVelocidadeMsPercentual(pControle.MovVelocidadeCErvasPercent),
velocidade_max = FuncoesMatematicas.CalculaVelocidadeMsPercentual(pControle.MovVelocidadeSErvasPercent)
};

View File

@ -820,7 +820,7 @@ namespace AgroBase.Models.Modules
indice = 1,
analise_health = true,
maximo = VariaveisEquipamento.CapacidadeReservatorio + 10.0,
minimo = VariaveisEquipamento.PercentualReservatorioMinCritio,
minimo = VariaveisEquipamento.PercentualReservatorioMinCritico,
nominal = VariaveisEquipamento.CapacidadeReservatorio,
unidade_medida = "Kg"
}

View File

@ -669,7 +669,7 @@ namespace AgroBase.Models.Modules
public class MovimentacaoMovimentoCompensadoModel
{
static List<TipoMovimentoDirecional> MovimentosCompensar = new List<TipoMovimentoDirecional>() { TipoMovimentoDirecional.RodasDianteiras, TipoMovimentoDirecional.RodasTraseiras, TipoMovimentoDirecional.MovimentoArco };
static GeometriaRobo g = new GeometriaRobo { L = VariaveisEquipamento.DistanciaEntreEixos / 100.0, W = VariaveisEquipamento.LarguraEquipamentoMm / 1000.0 };
static GeometriaRobo g = new GeometriaRobo { L = VariaveisEquipamento.DistanciaEntreEixosCm / 100.0, W = VariaveisEquipamento.LarguraEquipamentoMm / 1000.0 };
public static Dictionary<string, double> compensacoes { get; set; } = new Dictionary<string, double>();
public static Dictionary<string, double> _compAnt { get; set; }

View File

@ -1634,7 +1634,7 @@ namespace AgroBase.Models
bool dirSaudavel = statusValidos.Contains(saude.FirstOrDefault(x => x.modulo == T_Code.Dir)?.status ?? StatusModulo.Desconectado);
bool movSaudavel = statusValidos.Contains(saude.FirstOrDefault(x => x.modulo == T_Code.Mov)?.status ?? StatusModulo.Desconectado);
bool reservatorioOk = (op.Sensoriamento?.Atuador?.PercentualReservatorio ?? 0) > VariaveisEquipamento.PercentualReservatorioMinCritio;
bool reservatorioOk = (op.Sensoriamento?.Atuador?.PercentualReservatorio ?? 0) > VariaveisEquipamento.PercentualReservatorioMinCritico;
bool bombaOk = dispAtu?.Dados?.BombaPressurizadora?.Inicializado ?? false;

View File

@ -22,7 +22,7 @@ namespace AgroBase.Models
#region PARAMETROS
public double AnguloAberturaCurva { get; set; } = 25; // Angulo usado para deslocar o ponto de curva
public double DistanciaProjecaoRua { get; set; } = (VariaveisEquipamento.DistanciaEntreEixos / 100.0 / 2.0) + 3.0; // Distancia para projetar o primeiro ponto para fora do corredor
public double DistanciaProjecaoRua { get; set; } = (VariaveisEquipamento.DistanciaEntreEixosCm / 100.0 / 2.0) + 3.0; // Distancia para projetar o primeiro ponto para fora do corredor
public static double DistanciaEntrePontos { get; set; } = 0.8; // Distancia entre os pontos dentro do corredor
public static double DistanciaEntrePontosCurva { get; set; } = 0.25; // Distancia entre os pontos durante a curva entre corredores
private double DistanciaManobraEntreRuas { get; set; } = 3.0; // Distancia máxima para gerar a curva de conexão entre os corredores

View File

@ -27,9 +27,10 @@ namespace AgroBase.Models
{
public class Variaveis
{
public static readonly bool IniciarWorkers = true;
public static readonly bool IniciarWorkers = false;
public static readonly bool UsarIHM = true;
public static readonly bool Producao = false;
public static bool DebugMode { get; set; } = true;
public static bool DebugMode { get; set; } = false;
public static bool Fechando { get; set; } = false;
public static string CaminhoSistema { get; set; } = AppDomain.CurrentDomain.BaseDirectory;
@ -861,9 +862,9 @@ namespace AgroBase.Models
public static double LarguraDireita { get; } = 44.0; // 22
public static double ComprimentoFrente { get; } = 90.0; // 7
public static double ComprimentoTras { get; } = 40.0; // 107
public static double DistanciaEntreEixos { get; } = 92.0;
public static double LeverArmFrontalCm { get; } = 37.0; // cm
public static double LeverArmLateralCm { get; } = 0.0; // cm
public static double DistanciaEntreEixosCm { get; set; } = 92.0;
public static double LeverArmFrontalCm { get; set; } = 37.0; // cm
public static double LeverArmLateralCm { get; set; } = 0.0; // cm
public static double LarguraEquipamentoMm
{
get
@ -876,7 +877,7 @@ namespace AgroBase.Models
public static double CorrenteMaximaBateria { get; set; } = 100.0;
public static double PercentualTensaoBateriaMin { get; set; } = 25.0;
public static double PercentualReservatorioMin { get; set; } = 8.0;
public static double PercentualReservatorioMinCritio { get; set; } = 5.0;
public static double PercentualReservatorioMinCritico { get; set; } = 5.0;
public static double PercentualToleranciaPressaoLinha { get; set; } = 0.15;
public static int QuantidadeCamerasSolo { get; set; } = 1;
public static int QuantidadeBicosPulverizadores { get; set; } = 7;
@ -1044,7 +1045,7 @@ namespace AgroBase.Models
double anguloControleRad = anguloControle * (Math.PI / 180.0);
// Evita divisão por zero (caso o ângulo seja muito pequeno)
double R = Math.Abs(anguloControleRad) < 0.01 ? 99999 : (DistanciaEntreEixos / 100.0) / Math.Tan(anguloControleRad);
double R = Math.Abs(anguloControleRad) < 0.01 ? 99999 : (DistanciaEntreEixosCm / 100.0) / Math.Tan(anguloControleRad);
// Ajusta o raio de curva de acordo com o tipo de movimento
switch (tipoMovimento)
@ -1120,7 +1121,7 @@ namespace AgroBase.Models
public static GPSModel SimularNovaPosicao(TipoMovimentoDirecional tipoMovimento, double anguloControleDeg, double velocidadeMs, double tempoDelta, double anguloAtualDeg, GPSModel pos)
{
double L = DistanciaEntreEixos / 100.0;
double L = DistanciaEntreEixosCm / 100.0;
// Defina deltas por modo
double dfDeg = 0, drDeg = 0;

View File

@ -60,6 +60,16 @@ namespace AgroBase.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap _base {
get {
object obj = ResourceManager.GetObject("_base", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -90,6 +100,16 @@ namespace AgroBase.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap bateria {
get {
object obj = ResourceManager.GetObject("bateria", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -170,6 +190,16 @@ namespace AgroBase.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap gnss {
get {
object obj = ResourceManager.GetObject("gnss", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -250,6 +280,26 @@ namespace AgroBase.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap rede1 {
get {
object obj = ResourceManager.GetObject("rede1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap reservatorio {
get {
object obj = ResourceManager.GetObject("reservatorio", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -300,6 +350,26 @@ namespace AgroBase.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap temperatura {
get {
object obj = ResourceManager.GetObject("temperatura", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap testes {
get {
object obj = ResourceManager.GetObject("testes", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -118,14 +118,14 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="seta_voltar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\seta_voltar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="pasta" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\pasta.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mcp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\mcp.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cana" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\cana.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="seta_voltar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\seta_voltar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ajustes" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\ajustes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -133,8 +133,8 @@
<data name="transferidor" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\transferidor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="esp32-s3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\esp32-s3.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="diagnostico" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\diagnostico.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="voltar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\voltar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -145,9 +145,6 @@
<data name="rosa_dos_ventos" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\rosa_dos_ventos.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pasta" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\pasta.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="wifi_off" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\wifi_off.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -163,8 +160,8 @@
<data name="wifi_on" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\wifi_on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="diagnostico" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\diagnostico.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="roda_superior" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\roda_superior.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="salvar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\salvar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -175,14 +172,17 @@
<data name="atualizar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\atualizar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ads" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\ads.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="rede" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\rede.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="fechar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\fechar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="roda_superior" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\roda_superior.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="esp32-s3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\esp32-s3.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="localizacao" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\localizacao.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -196,10 +196,31 @@
<data name="robo_superior" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\robo_superior.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cana" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\cana.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="desligar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\desligar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ads" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\ads.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="testes" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\testes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bateria" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\bateria.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="gnss" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\gnss.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="rede1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\rede.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="reservatorio" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\reservatorio.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="temperatura" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\temperatura.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="_base" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Imagens\base.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -128,7 +128,7 @@ namespace AgroBase.Services
get
{
double percentualMinimo = Clamp(
VariaveisEquipamento.PercentualReservatorioMinCritio,
VariaveisEquipamento.PercentualReservatorioMinCritico,
0,
100
);

View File

@ -242,7 +242,7 @@ namespace AgroBase.Services.Operadores
("serial_number", VariaveisEquipamento.Parametros.serial_number),
("pct_vel_min", VariaveisEquipamento.PercentualVelMin),
("largura", VariaveisEquipamento.LarguraEquipamentoMm / 1000.0),
("distancia_entre_eixos", VariaveisEquipamento.DistanciaEntreEixos / 100.0),
("distancia_entre_eixos", VariaveisEquipamento.DistanciaEntreEixosCm / 100.0),
("qtd_bicos", VariaveisEquipamento.QuantidadeBicosPulverizadores),
("percentual_reservatorio_min", VariaveisEquipamento.PercentualReservatorioMin),
("percentual_tensao_bateria_min", VariaveisEquipamento.PercentualTensaoBateriaMin),

View File

@ -46,99 +46,54 @@ namespace AgroBase.Services
public static readonly string SplitConfig = "*";
public static readonly string SplitSubParams = "~";
public static readonly List<T_Code> DispositivosMotores =
new List<T_Code> { T_Code.Mov, T_Code.Dir };
public static readonly List<T_Code> DispositivosConexaoInicial =
new List<T_Code> { T_Code.Mvd, T_Code.Atu, T_Code.Sen };
public static readonly List<T_Code> DispositivosProprios =
new List<T_Code> { T_Code.Atu, T_Code.Sen };
public static readonly List<T_Code> DispositivosModbus =
new List<T_Code> { T_Code.Pzm, T_Code.Wit, T_Code.A05 };
public static readonly List<T_Code> DispositivosCan =
new List<T_Code>
{
T_Code.Mov,
T_Code.Oid,
T_Code.Dir,
T_Code.Mks,
T_Code.Sen,
T_Code.Atu
};
public static readonly List<T_Code> DispositivosMultiplos =
new List<T_Code>
{
T_Code.Bld,
T_Code.Mks,
T_Code.Mvd,
T_Code.Oid,
T_Code.Mov,
T_Code.Dir
};
public static readonly List<T_Code> DispositivosMotores = new List<T_Code> { T_Code.Mov, T_Code.Dir };
public static readonly List<T_Code> DispositivosConexaoInicial = new List<T_Code> { T_Code.Mvd, T_Code.Atu, T_Code.Sen };
public static readonly List<T_Code> DispositivosProprios = new List<T_Code> { T_Code.Atu, T_Code.Sen };
public static readonly List<T_Code> DispositivosModbus = new List<T_Code> { T_Code.Pzm, T_Code.Wit, T_Code.A05 };
public static readonly List<T_Code> DispositivosCan = new List<T_Code>
{
T_Code.Mov,
T_Code.Oid,
T_Code.Dir,
T_Code.Mks,
T_Code.Sen,
T_Code.Atu
};
public static readonly List<T_Code> DispositivosMultiplos = new List<T_Code>
{
T_Code.Bld,
T_Code.Mks,
T_Code.Mvd,
T_Code.Oid,
T_Code.Mov,
T_Code.Dir
};
/// <summary>
/// Mantido público por compatibilidade.
/// Código novo deve preferir GetDispositivosMapeadosSnapshot(),
/// AdicionarOuAtualizarDispositivoMapeado() e RemoverDispositivoMapeado().
/// </summary>
public static List<DispositivoDetalhesModel> DispositivosMapeados =
CriarListaInicialDispositivos();
public static List<DispositivoDetalhesModel> DispositivosMapeados = CriarListaInicialDispositivos();
// ============================================================
// SINCRONIZAÇÃO E CICLO DE VIDA
// ============================================================
private static readonly SemaphoreSlim _scanGate =
new SemaphoreSlim(1, 1);
private static readonly SemaphoreSlim _updateDevicesGate =
new SemaphoreSlim(1, 1);
private static readonly SemaphoreSlim _versioningGate =
new SemaphoreSlim(1, 1);
private static readonly SemaphoreSlim _syncDataGate =
new SemaphoreSlim(1, 1);
private static readonly object _mappedDevicesLock =
new object();
private static readonly object _connectedDevicesLock =
new object();
private static readonly object _lifecycleLock =
new object();
private static readonly object _metricsTextLock =
new object();
private static readonly ConcurrentDictionary<
string,
SemaphoreSlim> _portIoLocks =
new ConcurrentDictionary<
string,
SemaphoreSlim>(
StringComparer.OrdinalIgnoreCase
);
private static readonly ConcurrentDictionary<
string,
int> _missingPortConfirmations =
new ConcurrentDictionary<
string,
int>(
StringComparer.OrdinalIgnoreCase
);
private static readonly SemaphoreSlim _scanGate = new SemaphoreSlim(1, 1);
private static readonly SemaphoreSlim _updateDevicesGate = new SemaphoreSlim(1, 1);
private static readonly SemaphoreSlim _versioningGate = new SemaphoreSlim(1, 1);
private static readonly SemaphoreSlim _syncDataGate = new SemaphoreSlim(1, 1);
private static readonly object _mappedDevicesLock = new object();
private static readonly object _connectedDevicesLock = new object();
private static readonly object _lifecycleLock = new object();
private static readonly object _metricsTextLock = new object();
private static readonly ConcurrentDictionary<string, SemaphoreSlim> _portIoLocks = new ConcurrentDictionary<string, SemaphoreSlim>(StringComparer.OrdinalIgnoreCase);
private static readonly ConcurrentDictionary<string, int> _missingPortConfirmations = new ConcurrentDictionary<string, int>(StringComparer.OrdinalIgnoreCase);
public static int ConfirmacoesPortaAusente { get; set; } = 2;
private static CancellationTokenSource _lifetimeCts =
new CancellationTokenSource();
private static CancellationTokenSource _lifetimeCts = new CancellationTokenSource();
private static CancellationTokenSource _currentScanCts;
private static long _scanGeneration;
@ -194,6 +149,7 @@ namespace AgroBase.Services
private static int _uiUpdateScheduled;
private static string _pendingUiMessage;
public static string LastUIMessage;
// ============================================================
// ESCRITA SERIAL
@ -1178,12 +1134,9 @@ namespace AgroBase.Services
).GetAwaiter().GetResult();
}
private static async Task AtualizarDispositivosAsync(
CancellationToken cancellationToken)
private static async Task AtualizarDispositivosAsync(CancellationToken cancellationToken)
{
await _updateDevicesGate
.WaitAsync(cancellationToken)
.ConfigureAwait(false);
await _updateDevicesGate.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
@ -1191,52 +1144,27 @@ namespace AgroBase.Services
lock (_connectedDevicesLock)
{
firstExecution =
!Variaveis.DispositivosConectados.Any();
firstExecution = !Variaveis.DispositivosConectados.Any();
foreach (T_Code code in
DispositivosConexaoInicial)
foreach (T_Code code in DispositivosConexaoInicial)
{
IDispositivosService service =
Variaveis.DispositivosConectados
.FirstOrDefault(
x => x.Dispositivo == code
);
IDispositivosService service = Variaveis.DispositivosConectados.FirstOrDefault(x => x.Dispositivo == code);
if (service != null)
continue;
List<string> moduleIds =
List<string> moduleIds =
GetDispositivosMapeadosSnapshot()
.Where(
x => x.Dispositivo == code
)
.Select(x => x.Mod_ID)
.Where(
x => !string.IsNullOrWhiteSpace(x)
)
.ToList();
.Where(x => x.Dispositivo == code)
.Select(x => x.Mod_ID)
.Where(x => !string.IsNullOrWhiteSpace(x))
.ToList();
service =
DispositivosServiceFactory
.CreateDispositivoService(
code,
"Nome: " +
Enum.GetName(
typeof(T_Code),
code
),
"Descrição: " +
string.Join(
", ",
moduleIds.ToArray()
)
);
service = DispositivosServiceFactory.CreateDispositivoService(code, "Nome: " + Enum.GetName(typeof(T_Code), code), "Descrição: " + string.Join(", ", moduleIds.ToArray()));
service.CarregarParametrosModulos();
Variaveis.DispositivosConectados
.Add(service);
Variaveis.DispositivosConectados.Add(service);
service.Dados.IniciarRegistrador();
}
@ -1256,33 +1184,34 @@ namespace AgroBase.Services
if (frmInstancial.frmPrincipal == null)
return;
ComboBox combo =
frmInstancial.frmPrincipal
.cmbModoOperacao;
ComboBox combo = frmInstancial.frmPrincipal.cmbModoOperacao;
if (combo == null ||
combo.IsDisposed ||
combo.Disposing)
if (combo == null || combo.IsDisposed || combo.Disposing)
{
return;
}
Action action = () =>
{
if (!combo.IsDisposed &&
!combo.Disposing)
if (!combo.IsDisposed && !combo.Disposing)
{
combo.SelectedIndex =
(int)ModoOperacao.MapaGPS;
combo.SelectedIndex = (int)ModoOperacao.MapaGPS;
}
};
try
{
if (combo.InvokeRequired)
combo.BeginInvoke(action);
if (Variaveis.UsarIHM)
{
Variaveis.OperacaoEmAndamento = OperacaoModel.CarregarParametrosOperacaoPadrao(ModoOperacao.MapaGPS, true);
}
else
action();
{
if (combo.InvokeRequired)
combo.BeginInvoke(action);
else
action();
}
}
catch
{
@ -1711,86 +1640,59 @@ namespace AgroBase.Services
return;
_pendingUiMessage = message;
LastUIMessage = _pendingUiMessage;
if (Interlocked.Exchange(
ref _uiUpdateScheduled,
1) == 1)
if (Interlocked.Exchange(ref _uiUpdateScheduled, 1) == 1)
{
return;
}
Form principal = frmInstancial.frmPrincipal;
if (principal == null ||
principal.IsDisposed ||
principal.Disposing ||
!principal.IsHandleCreated)
{
Interlocked.Exchange(
ref _uiUpdateScheduled,
0
);
return;
}
//Form principal = frmInstancial.frmPrincipal;
//
//if (principal == null || principal.IsDisposed || principal.Disposing || !principal.IsHandleCreated)
//{
// Interlocked.Exchange(ref _uiUpdateScheduled, 0);
// return;
//}
try
{
principal.BeginInvoke(
(MethodInvoker)(() =>
{
try
{
string pending =
_pendingUiMessage;
if (frmInstancial.frmPrincipal != null &&
!frmInstancial.frmPrincipal.IsDisposed)
{
frmInstancial.frmPrincipal
.lblStatusConexao
.Text = pending;
}
if (frmInstancial.frmIHM != null &&
frmInstancial.frmIHM.IsHandleCreated &&
!frmInstancial.frmIHM.IsDisposed)
{
frmInstancial.frmIHM
.lblStatus
.Text = pending;
}
}
finally
{
Interlocked.Exchange(
ref _uiUpdateScheduled,
0
);
/*
* Se outra mensagem chegou durante o callback,
* agenda somente a mais recente.
*/
if (!string.Equals(
_pendingUiMessage,
message,
StringComparison.Ordinal))
{
AtualizarConsole(
_pendingUiMessage
);
}
}
})
);
//principal.BeginInvoke(
// (MethodInvoker)(() =>
// {
// try
// {
// string pending = _pendingUiMessage;
//
// if (frmInstancial.frmPrincipal != null && !frmInstancial.frmPrincipal.IsDisposed)
// {
// frmInstancial.frmPrincipal.lblStatusConexao.Text = pending;
// }
//
// if (frmInstancial.frmIHM != null && frmInstancial.frmIHM.IsHandleCreated && !frmInstancial.frmIHM.IsDisposed)
// {
// frmInstancial.frmIHM.frmMenu.lblStatus.Text = pending;
// }
// }
// finally
// {
// Interlocked.Exchange(ref _uiUpdateScheduled, 0);
//
// /*
// * Se outra mensagem chegou durante o callback,
// * agenda somente a mais recente.
// */
// if (!string.Equals(_pendingUiMessage, message, StringComparison.Ordinal))
// {
// AtualizarConsole(_pendingUiMessage);
// }
// }
// })
//);
}
catch
{
Interlocked.Exchange(
ref _uiUpdateScheduled,
0
);
Interlocked.Exchange(ref _uiUpdateScheduled, 0);
}
}

View File

@ -1165,54 +1165,26 @@ namespace AgroBase.Services
private static void AtualizarConsole(string msg, int val)
{
Console.WriteLine(msg);
Variaveis.MostrarLog("[VersionamentoService.AtualizarConsole] " + msg);
try
{
if (!Variaveis.IsAgroBase)
return;
if (frmInstancial.frmPrincipal == null || !frmInstancial.frmPrincipal.Created || frmInstancial.frmPrincipal.IsDisposed)
{
bool frmIhmIndisponivel = frmInstancial.frmIHM == null || !frmInstancial.frmIHM.Created || frmInstancial.frmIHM.IsDisposed;
bool frmPrincipalIndisponivel = frmInstancial.frmPrincipal == null || !frmInstancial.frmPrincipal.Created || frmInstancial.frmPrincipal.IsDisposed;
if (Variaveis.UsarIHM && frmIhmIndisponivel)
return;
else if (frmPrincipalIndisponivel)
return;
}
frmInstancial.frmPrincipal.BeginInvoke(
(MethodInvoker)(() =>
{
try
{
frmInstancial
.frmPrincipal
.lblProgressoAtualizacao
.Text = msg;
FuncoesGlobais.PreencheValorProgressBar(
frmInstancial
.frmPrincipal
.pgbAtualizacaoArquivos,
val
);
if (frmInstancial.frmIHM != null &&
!frmInstancial.frmIHM.IsDisposed)
{
frmInstancial
.frmIHM
.lblProgressoAtualizacao
.Text = msg;
FuncoesGlobais
.PreencheValorProgressBar(
frmInstancial
.frmIHM
.pgbAtualizacaoArquivos,
val
);
}
}
catch { }
}));
if (!frmIhmIndisponivel)
frmInstancial.frmIHM?.frmMenu?.AtualizarProgressoSyncArquivos(msg, val);
if (!frmPrincipalIndisponivel)
frmInstancial.frmPrincipal?.AtualizarProgressoSyncArquivos(msg, val);
}
catch { }
}
@ -1238,9 +1210,7 @@ namespace AgroBase.Services
}
}
private static void Forget(
Task task,
string context)
private static void Forget(Task task, string context)
{
if (task == null)
return;

View File

@ -650,9 +650,12 @@ class WeedDetector:
cfg=cfg,
)
# Integral image para somar retângulos rápido.
# Integral image em inteiro com sinal.
# Evita overflow nos cálculos A - B - C + D.
ii = np.pad(
mask_target.astype(np.uint8).cumsum(axis=0).cumsum(axis=1),
mask_target.astype(np.int64, copy=False)
.cumsum(axis=0, dtype=np.int64)
.cumsum(axis=1, dtype=np.int64),
((1, 0), (1, 0)),
mode="constant",
constant_values=0,