diff --git a/CtrEditor.csproj b/CtrEditor.csproj
index 01e6ff4..cfbdb43 100644
--- a/CtrEditor.csproj
+++ b/CtrEditor.csproj
@@ -130,7 +130,7 @@
-
+
diff --git a/FuncionesBase/ZIndexEnum.cs b/FuncionesBase/ZIndexEnum.cs
index b8bbd3e..dcdb478 100644
--- a/FuncionesBase/ZIndexEnum.cs
+++ b/FuncionesBase/ZIndexEnum.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace CtrEditor.FuncionesBase
+namespace CtrEditor.FuncionesBase
{
public enum ZIndexEnum
{
diff --git a/MainViewModel.cs b/MainViewModel.cs
index bbd1e03..4438746 100644
--- a/MainViewModel.cs
+++ b/MainViewModel.cs
@@ -119,6 +119,15 @@ namespace CtrEditor
EstadoPersistente.Instance.GuardarEstado(); // Guardar el estado actualizado
DatosDeTrabajo.CargarImagenes();
ListaImagenes = new ObservableCollection(DatosDeTrabajo.Imagenes.Keys); // Actualizar claves
+ // Si no hay imágenes en el directorio, copiar base.png desde los recursos
+ if (!ListaImagenes.Any())
+ {
+ CopiarImagenBase(value);
+ // Recargar las imágenes después de copiar la imagen base
+ DatosDeTrabajo.CargarImagenes();
+ ListaImagenes = new ObservableCollection(DatosDeTrabajo.Imagenes.Keys); // Actualizar claves nuevamente
+ }
+
SelectedImage = null;
var x = ListaImagenes.FirstOrDefault(o => o == EstadoPersistente.Instance.imagen, null);
if (EstadoPersistente.Instance.imagen != null && EstadoPersistente.Instance.imagen.Length > 0 && x != null)
@@ -132,6 +141,34 @@ namespace CtrEditor
}
}
+ // Función para copiar la imagen base desde los recursos
+ private void CopiarImagenBase(string directorio)
+ {
+ try
+ {
+ // Obtener el path del archivo base.png desde los recursos (dentro del ensamblado)
+ var assembly = Assembly.GetExecutingAssembly();
+ var resourcePath = "CtrEditor.Images.base.png"; // Ajusta el namespace y el path según tu proyecto
+
+ using (Stream resourceStream = assembly.GetManifestResourceStream(resourcePath))
+ {
+ if (resourceStream != null)
+ {
+ string destino = Path.Combine(directorio, "base.png");
+
+ using (FileStream fileStream = new FileStream(destino, FileMode.Create, FileAccess.Write))
+ {
+ resourceStream.CopyTo(fileStream);
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"Error al copiar la imagen base: {ex.Message}");
+ }
+ }
+
[RelayCommand]
public void DebugWindow()
{
@@ -209,7 +246,7 @@ namespace CtrEditor
PLCViewModel = new PLCViewModel();
_timerPLCUpdate = new DispatcherTimer();
- _timerPLCUpdate.Interval = TimeSpan.FromMilliseconds(100); // ajusta el intervalo según sea necesario
+ _timerPLCUpdate.Interval = TimeSpan.FromMilliseconds(2); // ajusta el intervalo según sea necesario
_timerPLCUpdate.Tick += OnRefreshEvent;
InitializeTipoSimulableList();
diff --git a/ObjetosSim/Dinamicos/ucBotella.xaml.cs b/ObjetosSim/Dinamicos/ucBotella.xaml.cs
index 362c34f..6471a52 100644
--- a/ObjetosSim/Dinamicos/ucBotella.xaml.cs
+++ b/ObjetosSim/Dinamicos/ucBotella.xaml.cs
@@ -60,12 +60,7 @@ namespace CtrEditor.ObjetosSim
private float inercia_desde_simulacion;
[ObservableProperty]
- bool test;
-
- partial void OnTestChanged(bool value)
- {
- SimGeometria.Body.LinearVelocity = new Vector2(1,1);
- }
+ private bool preserve_Outside_Transport;
[ObservableProperty]
private float porcentaje_Traccion;
@@ -93,9 +88,8 @@ namespace CtrEditor.ObjetosSim
private void ActualizarGeometrias()
{
- if (SimGeometria != null)
- {
-
+ if (SimGeometria != null && !RemoverDesdeSimulacion)
+ {
SimGeometria.SetPosition(GetCentro());
}
}
@@ -109,8 +103,11 @@ namespace CtrEditor.ObjetosSim
public void UpdateAfterMove()
{
- ActualizarGeometrias();
- SimGeometria?.SetDiameter(Diametro);
+ if (!RemoverDesdeSimulacion)
+ {
+ ActualizarGeometrias();
+ SimGeometria?.SetDiameter(Diametro);
+ }
}
public override void UpdateGeometryStart()
@@ -126,6 +123,7 @@ namespace CtrEditor.ObjetosSim
}
public override void UpdateControl(int elapsedMilliseconds)
{
+
SetCentro(SimGeometria.Center);
if (SimGeometria.isRestricted)
ColorButton_oculto = Brushes.Yellow;
@@ -136,8 +134,15 @@ namespace CtrEditor.ObjetosSim
else
ColorButton_oculto = Brushes.Gray;
}
- if (SimGeometria.Descartar) // Ha sido marcada para remover
+
+ // Ha sido marcada para remover
+ if (SimGeometria.Descartar)
RemoverDesdeSimulacion = true;
+
+ // Eliminar la botella si esta fuera de un transporte
+ if (!Preserve_Outside_Transport && Porcentaje_Traccion == 0 && Math.Abs(SimGeometria.Body.LinearVelocity.X) <= 0.001 && Math.Abs(SimGeometria.Body.LinearVelocity.Y) <= 0.001)
+ RemoverDesdeSimulacion = true;
+
Velocidad_desde_simulacion = SimGeometria.Body.LinearVelocity.ToString();
Inercia_desde_simulacion = SimGeometria.Body.Inertia;
Porcentaje_Traccion = SimGeometria.OverlapPercentage;
diff --git a/ObjetosSim/Emuladores/ucBottGenerator.xaml.cs b/ObjetosSim/Emuladores/ucBottGenerator.xaml.cs
index b2694e5..90d1347 100644
--- a/ObjetosSim/Emuladores/ucBottGenerator.xaml.cs
+++ b/ObjetosSim/Emuladores/ucBottGenerator.xaml.cs
@@ -4,6 +4,7 @@ using System.Windows.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Diagnostics;
using CtrEditor.FuncionesBase;
+using System.ComponentModel;
namespace CtrEditor.ObjetosSim
{
@@ -34,9 +35,15 @@ namespace CtrEditor.ObjetosSim
[ObservableProperty]
private float offsetTopSalida;
+
[ObservableProperty]
+ [property: Description("PLC tag for consense to run. 1 => always")]
+ [property: Category("Enable to Run:")]
private string tag_consenso;
+
[ObservableProperty]
+ [property: Description("Consense to run.")]
+ [property: Category("Enable to Run:")]
private bool consenso;
partial void OnConsensoChanged(bool value)
@@ -44,11 +51,25 @@ namespace CtrEditor.ObjetosSim
_TON_TOFF.Senal = value;
}
[ObservableProperty]
+ [property: Description("Consense is Normally close.")]
+ [property: Category("Enable to Run:")]
private bool consenso_NC;
[ObservableProperty]
+ [property: Description("Enable filter.")]
+ [property: Category("Enable to Run:")]
private bool consenso_Filtrado;
[ObservableProperty]
- float filtro_consenso_s;
+ [property: Description("Time ON in s.")]
+ [property: Category("Enable to Run:")]
+ float filtro_consenso_ON_s;
+ [ObservableProperty]
+ [property: Description("Time OFF in s.")]
+ [property: Category("Enable to Run:")]
+ float filtro_consenso_OFF_s;
+ [ObservableProperty]
+ [property: Description("Filter OUT signal.")]
+ [property: Category("Enable to Run:")]
+ bool filter_Output;
[ObservableProperty]
private float botellas_hora;
@@ -77,10 +98,11 @@ namespace CtrEditor.ObjetosSim
Ancho = 0.30f;
Alto = 0.30f;
Angulo = 0;
- Velocidad_actual_percentual = 0;
+ Velocidad_actual_percentual = 100;
Diametro_botella = 0.1f;
Botellas_hora = 10000;
- Filtro_consenso_s = 1;
+ Filtro_consenso_ON_s = 1;
+ Filtro_consenso_OFF_s = 0.1f;
}
public override void UpdatePLC(PLCViewModel plc, int elapsedMilliseconds)
@@ -95,20 +117,22 @@ namespace CtrEditor.ObjetosSim
{
bool habilitado;
- _TON_TOFF.Tiempo_ON_s = _TON_TOFF.Tiempo_OFF_s = Filtro_consenso_s;
+ _TON_TOFF.Tiempo_ON_s = Filtro_consenso_ON_s;
+ _TON_TOFF.Tiempo_OFF_s = Filtro_consenso_OFF_s;
if (Consenso_Filtrado)
habilitado = _TON_TOFF.SenalFiltrada();
else
habilitado = Consenso;
+ Filter_Output = habilitado;
+
if (habilitado && Velocidad_actual_percentual > 0)
{
TiempoRestante -= elapsedMilliseconds / 1000.0f;
if (TiempoRestante <= 0)
{
- TiempoRestante += 3600 / (Botellas_hora * (Velocidad_actual_percentual / 100.0f));
-
+ bool BotellaCreada = false;
var X = Left + OffsetLeftSalida;
var Y = Top + OffsetTopSalida;
@@ -122,21 +146,26 @@ namespace CtrEditor.ObjetosSim
((osBotella)nuevaBotella).Diametro = Diametro_botella;
nuevaBotella.AutoCreated = true;
UltimaBotella = (osBotella)nuevaBotella;
+ BotellaCreada = true;
}
else
{
// Calcular la distancia entre el centro de la última botella y la nueva posición
float distancia = (float)Math.Sqrt(Math.Pow(UltimaBotella.Left - X, 2) + Math.Pow(UltimaBotella.Top - Y, 2));
- float distanciaMinima = Diametro_botella / 2; // Asumiendo que el diámetro de la nueva botella es similar
+ float distanciaMinima = Diametro_botella / 4; // Asumiendo que el diámetro de la nueva botella es similar
if (distancia > distanciaMinima)
{
- var nuevaBotella = _mainViewModel.CrearObjetoSimulable(typeof(osBotella), X, Y);
- ((osBotella)nuevaBotella).Diametro = Diametro_botella;
+ osBotella nuevaBotella = (osBotella)_mainViewModel.CrearObjetoSimulable(typeof(osBotella), X, Y);
+ nuevaBotella.Diametro = Diametro_botella;
nuevaBotella.AutoCreated = true;
- UltimaBotella = (osBotella)nuevaBotella;
+ UltimaBotella = nuevaBotella;
+ BotellaCreada = true;
}
}
+ if (BotellaCreada)
+ TiempoRestante += 3600 / (Botellas_hora * (Velocidad_actual_percentual / 100.0f));
+
}
}
else
diff --git a/ObjetosSim/Emuladores/ucFiller.xaml.cs b/ObjetosSim/Emuladores/ucFiller.xaml.cs
index 2e77304..19a8234 100644
--- a/ObjetosSim/Emuladores/ucFiller.xaml.cs
+++ b/ObjetosSim/Emuladores/ucFiller.xaml.cs
@@ -131,10 +131,10 @@ namespace CtrEditor.ObjetosSim
if (distancia > distanciaMinima)
{
- var nuevaBotella = _mainViewModel.CrearObjetoSimulable(typeof(osBotella), X, Y);
- ((osBotella)nuevaBotella).Diametro = Diametro_botella;
+ osBotella nuevaBotella = (osBotella)_mainViewModel.CrearObjetoSimulable(typeof(osBotella), X, Y);
+ nuevaBotella.Diametro = Diametro_botella;
nuevaBotella.AutoCreated = true;
- UltimaBotella = (osBotella)nuevaBotella;
+ UltimaBotella = nuevaBotella;
}
}
}
diff --git a/ObjetosSim/Estaticos/ucVMmotorSim.xaml.cs b/ObjetosSim/Estaticos/ucVMmotorSim.xaml.cs
index a337a22..bb5d505 100644
--- a/ObjetosSim/Estaticos/ucVMmotorSim.xaml.cs
+++ b/ObjetosSim/Estaticos/ucVMmotorSim.xaml.cs
@@ -1,11 +1,11 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using CtrEditor.FuncionesBase;
using LibS7Adv;
+using Newtonsoft.Json;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
-using Newtonsoft.Json;
-using CommunityToolkit.Mvvm.ComponentModel;
-using CtrEditor.FuncionesBase;
namespace CtrEditor.ObjetosSim
{
@@ -45,7 +45,7 @@ namespace CtrEditor.ObjetosSim
}
[ObservableProperty]
- public float proporcionalSpeed;
+ public float proporcional_Speed;
[ObservableProperty]
public float max_Speed_for_Ramp;
@@ -70,7 +70,7 @@ namespace CtrEditor.ObjetosSim
partial void OnPLC_NumeroMotorChanged(int value)
{
- if (PLC_DB_Motor==0)
+ if (PLC_DB_Motor == 0)
{
PLC_DB_Motor = PLC_NumeroMotor - 30 + 300;
}
@@ -98,7 +98,7 @@ namespace CtrEditor.ObjetosSim
{
Tamano = 0.30f;
PLC_NumeroMotor = 31;
- ProporcionalSpeed = 100;
+ Proporcional_Speed = 100;
Max_Speed_for_Ramp = 100;
TiempoRampa = 3;
ImageSource_oculta = ImageFromPath("/imagenes/motor2.png");
@@ -112,7 +112,7 @@ namespace CtrEditor.ObjetosSim
public override void UpdatePLC(PLCViewModel plc, int elapsedMilliseconds)
{
motState.UpdatePLC(plc, this, elapsedMilliseconds);
- Velocidad = (ProporcionalSpeed / 100) * (motState.STATUS_VFD_ACT_Speed_Hz / 10);
+ Velocidad = (Proporcional_Speed / 100) * (motState.STATUS_VFD_ACT_Speed_Hz / 10);
}
public override void UpdateControl(int elapsedMilliseconds)
diff --git a/ObjetosSim/Extraccion Datos/ucBuscarCoincidencias.xaml.cs b/ObjetosSim/Extraccion Datos/ucBuscarCoincidencias.xaml.cs
index 801ab81..6cb4dee 100644
--- a/ObjetosSim/Extraccion Datos/ucBuscarCoincidencias.xaml.cs
+++ b/ObjetosSim/Extraccion Datos/ucBuscarCoincidencias.xaml.cs
@@ -2,16 +2,12 @@
using System.Windows.Controls;
using System.Windows.Media;
using CommunityToolkit.Mvvm.ComponentModel;
-using CtrEditor.Simulacion;
using System.IO;
using System.Windows.Media.Imaging;
-using Tesseract;
using Emgu.CV.CvEnum;
-using Emgu.CV.Structure;
using Emgu.CV;
using System.Drawing;
using Image = System.Windows.Controls.Image;
-using Point = System.Drawing.Point;
using Rectangle = System.Windows.Shapes.Rectangle;
using Size = System.Drawing.Size;
using Ookii.Dialogs.Wpf;
@@ -21,9 +17,7 @@ using Newtonsoft.Json;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using System.ComponentModel;
using ClosedXML.Excel;
-using DocumentFormat.OpenXml.Spreadsheet;
using Colors = System.Windows.Media.Colors;
-using DocumentFormat.OpenXml.Drawing.Charts;
using CtrEditor.FuncionesBase;
namespace CtrEditor.ObjetosSim.Extraccion_Datos
@@ -341,7 +335,7 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
{
float offsetX = PixelsToMeters((float)rectangle.X) - Left;
float offsetY = PixelsToMeters((float)rectangle.Y) - Top;
-
+
osExtraccionTag newObj = null;
foreach (var eTag in objetosSimulables2Copy)
diff --git a/ObjetosSim/Extraccion Datos/ucExtraccionTag.xaml.cs b/ObjetosSim/Extraccion Datos/ucExtraccionTag.xaml.cs
index 0246fa8..12a2215 100644
--- a/ObjetosSim/Extraccion Datos/ucExtraccionTag.xaml.cs
+++ b/ObjetosSim/Extraccion Datos/ucExtraccionTag.xaml.cs
@@ -1,13 +1,10 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Navigation;
+using ClosedXML.Excel;
using CommunityToolkit.Mvvm.ComponentModel;
-using CtrEditor.Simulacion;
-using Newtonsoft.Json;
-using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
-using System.ComponentModel;
-using ClosedXML.Excel;
using CtrEditor.FuncionesBase;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Controls;
+using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
namespace CtrEditor.ObjetosSim.Extraccion_Datos
{
@@ -26,9 +23,9 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
public override string Nombre
{
get => nombre;
- set
+ set
{
- if (Collumn_name == null || Collumn_name.Length==0)
+ if (Collumn_name == null || Collumn_name.Length == 0)
Collumn_name = value;
SetProperty(ref nombre, value);
}
@@ -44,7 +41,7 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
public override void TopChanged(float value)
{
base.TopChanged(value);
- if (Extraer) ResetTimer();
+ if (Extraer) ResetTimer();
}
public override void LeftChanged(float value)
@@ -59,24 +56,25 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
ResetTimer();
}
- public override void OnResize(float Delta_Width, float Delta_Height)
+ public override void OnResize(float Delta_Width, float Delta_Height)
{
if (Extraer)
ResetTimer();
}
- public override void OnMove(float LeftPixels, float TopPixels)
+ public override void OnMove(float LeftPixels, float TopPixels)
{
if (Extraer)
ResetTimer();
}
- public override void OnRotate(float Angle)
+ public override void OnRotate(float Angle)
{
if (Extraer)
ResetTimer();
}
- public override void OnTimerAfterMovement() {
+ public override void OnTimerAfterMovement()
+ {
Angulo = (float)Math.Round(Angulo / 90) * 90;
if (Extraer)
@@ -84,7 +82,7 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
Extraer = false;
}
-
+
private osBuscarCoincidencias Search_Templates;
[ObservableProperty]
@@ -104,7 +102,7 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos
Search_Templates.PropertyChanged += OnMotorPropertyChanged;
}
}
-
+
private void OnMotorPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(osBuscarCoincidencias.Nombre))
diff --git a/ObjetosSim/SensoresComandos/ucPhotocell.xaml b/ObjetosSim/SensoresComandos/ucPhotocell.xaml
index 873b765..cab627c 100644
--- a/ObjetosSim/SensoresComandos/ucPhotocell.xaml
+++ b/ObjetosSim/SensoresComandos/ucPhotocell.xaml
@@ -38,8 +38,8 @@
Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}, ConverterParameter=2}"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2,2,2,2" Grid.Column="1"/>
-
+
diff --git a/ObjetosSim/SensoresComandos/ucPhotocell.xaml.cs b/ObjetosSim/SensoresComandos/ucPhotocell.xaml.cs
index d26f630..94e1a36 100644
--- a/ObjetosSim/SensoresComandos/ucPhotocell.xaml.cs
+++ b/ObjetosSim/SensoresComandos/ucPhotocell.xaml.cs
@@ -7,7 +7,9 @@ using System.Windows.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Diagnostics;
using CtrEditor.FuncionesBase;
-
+using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
+using JsonIgnoreAttribute = Newtonsoft.Json.JsonIgnoreAttribute;
+using System.ComponentModel;
namespace CtrEditor.ObjetosSim
{
@@ -20,7 +22,7 @@ namespace CtrEditor.ObjetosSim
Stopwatch timer;
double timer_lastPositive;
double timer_lastNegative;
-
+
public static string NombreClase()
{
return "Photocell";
@@ -32,9 +34,14 @@ namespace CtrEditor.ObjetosSim
set => SetProperty(ref nombre, value);
}
- [ObservableProperty]
+ [ObservableProperty]
+ [property: Description("Color")]
+ [property: Category("Layout:")]
Brush color;
+
[ObservableProperty]
+ [property: Description("Light cut")]
+ [property: Category("Debug:")]
bool luzCortada;
partial void OnLuzCortadaChanged(bool value)
@@ -67,9 +74,18 @@ namespace CtrEditor.ObjetosSim
}
[ObservableProperty]
+ [property: Description("Size of the Light.")]
+ [property: Category("Setup:")]
+ float ancho_Haz_De_Luz;
+
+ [ObservableProperty]
+ [property: Description("Distance to the neck.")]
+ [property: Category("Debug:")]
float distancia_cuello;
[ObservableProperty]
+ [property: Description("Type of detection: Neck of the bottle or Complete bottle.")]
+ [property: Category("Setup:")]
bool detectarCuello;
partial void OnDetectarCuelloChanged(bool value)
@@ -81,6 +97,8 @@ namespace CtrEditor.ObjetosSim
[ObservableProperty]
+ [property: Description("Filter signal.")]
+ [property: Category("Setup:")]
float filter_Frecuency;
partial void OnFilter_FrecuencyChanged(float value)
@@ -90,18 +108,24 @@ namespace CtrEditor.ObjetosSim
}
[ObservableProperty]
+ [property: Category("Debug:")]
float frecuency;
[ObservableProperty]
+ [property: Category("Debug:")]
float lenght_positive_pulse;
[ObservableProperty]
+ [property: Category("Debug:")]
float lenght_negative_pulse;
[ObservableProperty]
+ [property: Category("Debug:")]
float lenght_FP_to_FP;
[ObservableProperty]
+ [property: Description("Type Filter signal.")]
+ [property: Category("Setup:")]
public bool tipo_NC;
partial void OnTipo_NCChanged(bool value)
@@ -142,13 +166,14 @@ namespace CtrEditor.ObjetosSim
private void ActualizarGeometrias()
{
if (_visualRepresentation is ucPhotocell uc)
- UpdateRectangle(Simulation_Photocell, uc.Photocell, Alto, Ancho, Angulo);
+ UpdateRectangle(Simulation_Photocell, uc.Photocell, Ancho_Haz_De_Luz, Ancho, Angulo);
}
public osPhotocell()
{
Ancho = 1;
Alto = 0.03f;
+ Ancho_Haz_De_Luz = 0.01f;
Frecuency = 0;
timer = new Stopwatch();
timer.Start();
diff --git a/ObjetosSim/osBase.cs b/ObjetosSim/osBase.cs
index 89e9441..65b7b7c 100644
--- a/ObjetosSim/osBase.cs
+++ b/ObjetosSim/osBase.cs
@@ -1,29 +1,22 @@
-
-using System.Text.Json.Serialization;
-using System.Windows;
-using LibS7Adv;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CtrEditor.FuncionesBase;
using CtrEditor.Simulacion;
-using System.Windows.Media;
+using LibS7Adv;
using nkast.Aether.Physics2D.Common;
using Siemens.Simatic.Simulation.Runtime;
-using System.Windows.Media.Imaging;
-using CommunityToolkit.Mvvm.ComponentModel;
-using System.Windows.Media.Animation;
-using System.Diagnostics;
-using System.Windows.Shapes;
-using System.Windows.Controls;
using System.ComponentModel;
-using System.Configuration;
-using System.Windows.Threading;
+using System.Diagnostics;
using System.IO;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
using Tesseract;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
-using Newtonsoft.Json;
-using JsonIgnoreAttribute = Newtonsoft.Json.JsonIgnoreAttribute;
-using System.Collections.ObjectModel;
using ItemCollection = Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection;
-using nkast.Aether.Physics2D.Dynamics.Joints;
-using CtrEditor.FuncionesBase;
+using JsonIgnoreAttribute = Newtonsoft.Json.JsonIgnoreAttribute;
namespace CtrEditor.ObjetosSim
{
@@ -185,14 +178,14 @@ namespace CtrEditor.ObjetosSim
Move((float)LeftPixels, (float)TopPixels);
}
public void Move(float LeftPixels, float TopPixels)
- {
+ {
Left = PixelToMeter.Instance.calc.PixelsToMeters(LeftPixels);
Top = PixelToMeter.Instance.calc.PixelsToMeters(TopPixels);
OnMove(LeftPixels, TopPixels);
OnMoveResizeRotate();
}
public virtual void OnMove(float LeftPixels, float TopPixels) { }
-
+
public void Rotate(double Delta_Angle)
{
Rotate((float)Delta_Angle);
@@ -1068,12 +1061,12 @@ namespace CtrEditor.ObjetosSim
if (value)
{
ReiniciarTimer(_stopwatch_ON);
- _stopwatch_OFF.Reset();
+ StopTimer(_stopwatch_OFF);
}
else
{
- _stopwatch_ON.Reset();
ReiniciarTimer(_stopwatch_OFF);
+ StopTimer(_stopwatch_ON);
}
}
}
@@ -1097,9 +1090,13 @@ namespace CtrEditor.ObjetosSim
void ReiniciarTimer(Stopwatch timer)
{
- timer.Reset();
timer.Start();
}
+ void StopTimer(Stopwatch timer)
+ {
+ timer.Reset();
+ timer.Stop();
+ }
}