2026-03-10 19:56:55 +00:00
|
|
|
|
using OperationControl.Controls;
|
|
|
|
|
|
using OperationControl.Models;
|
|
|
|
|
|
using OperationControl.ViewModels.Views.Operacao;
|
2026-03-11 12:47:44 +00:00
|
|
|
|
using OperationControl.ViewModels.Views.Operacao.Diagnostico;
|
2026-03-10 19:56:55 +00:00
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace OperationControl.Views.Operacao
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Interaction logic for OperacaoCenterView.xaml
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class OperacaoCenterView : System.Windows.Controls.UserControl
|
|
|
|
|
|
{
|
|
|
|
|
|
public OperacaoCenterViewModel _vm;
|
|
|
|
|
|
|
|
|
|
|
|
public OperacaoCenterView()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
_vm = new OperacaoCenterViewModel();
|
|
|
|
|
|
DataContext = _vm;
|
|
|
|
|
|
|
|
|
|
|
|
videoFront = new TcpVideoReceiver(5000, imgVideoFront);
|
|
|
|
|
|
videoWeed = new TcpVideoReceiver(5002, imgVideoWeed);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private TcpVideoReceiver videoFront;
|
|
|
|
|
|
private TcpVideoReceiver videoWeed;
|
|
|
|
|
|
|
|
|
|
|
|
#region CAMERA FRONTAL
|
|
|
|
|
|
|
|
|
|
|
|
private void cmbCameraFrontalFrameTipo_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (VariaveisControleOperacao.SelectedRoverId == VariaveisControleOperacao.BaseMarkerID) return;
|
|
|
|
|
|
PararStreamCameraFrontal();
|
|
|
|
|
|
IniciarStreamCameraFrontal();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void IniciarStreamCameraFrontal()
|
|
|
|
|
|
{
|
|
|
|
|
|
videoFront.Iniciar();
|
2026-03-11 12:47:44 +00:00
|
|
|
|
var t = ((AgroBase.Models.Enums.TipoFrameCamera)cmbCameraFrontalFrameTipo.SelectedIndex);
|
|
|
|
|
|
VariaveisControleOperacao.EnviarComandoTransmissaoVideo(AgroBase.Models.Enums.T_Code.Snr, true, AgroBase.Models.Enums.TipoFrameCamera.Rgb);
|
2026-03-10 19:56:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void PararStreamCameraFrontal(bool finalizar = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
videoFront.Parar();
|
|
|
|
|
|
VariaveisControleOperacao.EnviarComandoTransmissaoVideo(AgroBase.Models.Enums.T_Code.Snr, false, ((AgroBase.Models.Enums.TipoFrameCamera)cmbCameraFrontalFrameTipo.SelectedIndex));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region CAMERA ERVAS
|
|
|
|
|
|
|
|
|
|
|
|
private void cmbCameraTraseiraFrameTipo_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (VariaveisControleOperacao.SelectedRoverId == VariaveisControleOperacao.BaseMarkerID) return;
|
|
|
|
|
|
PararStreamCameraErvas();
|
|
|
|
|
|
IniciarStreamCameraErvas();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void IniciarStreamCameraErvas()
|
|
|
|
|
|
{
|
|
|
|
|
|
videoWeed.Iniciar();
|
|
|
|
|
|
VariaveisControleOperacao.EnviarComandoTransmissaoVideo(AgroBase.Models.Enums.T_Code.Cam, true, ((AgroBase.Models.Enums.TipoFrameCamera)cmbCameraTraseiraFrameTipo.SelectedIndex));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void PararStreamCameraErvas(bool finalizar = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
videoWeed.Parar();
|
|
|
|
|
|
VariaveisControleOperacao.EnviarComandoTransmissaoVideo(AgroBase.Models.Enums.T_Code.Cam, false, ((AgroBase.Models.Enums.TipoFrameCamera)cmbCameraTraseiraFrameTipo.SelectedIndex));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void MAP_MarkerClicked(object? sender, MapMarkerManager.MarkerClickedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
_vm.ProcessarMarkerClicked(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void MAP_StreetMapClicked(object? sender, MapViewControl.StreetMapClickedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
_vm.ProcessarStreetMapClicked(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-11 12:47:44 +00:00
|
|
|
|
public void AtualizarGraficoDiagnostico(DiagnosticoViewModel vm)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (vm == null || pltSaude_Acompanhamento == null)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
var plot = pltSaude_Acompanhamento.Plot;
|
|
|
|
|
|
plot.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var serie in vm.SeriesGrafico)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (serie.Valores.Count == 0)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
double[] ys = serie.Valores.ToArray();
|
|
|
|
|
|
double[] xs = Enumerable.Range(0, ys.Length).Select(i => (double)i).ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
plot.Add.Scatter(xs, ys);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
plot.Axes.AutoScale();
|
|
|
|
|
|
pltSaude_Acompanhamento.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-10 19:56:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|