Se actualizaron las propiedades en las clases osBase, ucCustomImage y ucVMmotorSim para utilizar el nuevo atributo [property: JsonIgnore], mejorando la gestión de la serialización JSON. Además, se ajustó la configuración del serializador en StateSerializer.cs para respetar los atributos JsonIgnore, optimizando la deserialización de objetos.
This commit is contained in:
parent
5c2daaeb98
commit
1449544d71
|
@ -1,7 +1,7 @@
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using LibS7Adv;
|
using LibS7Adv;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using CtrEditor.FuncionesBase;
|
using CtrEditor.FuncionesBase;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -75,8 +75,8 @@ namespace CtrEditor.ObjetosSim
|
||||||
private bool vertical_Flip;
|
private bool vertical_Flip;
|
||||||
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[property: JsonIgnore]
|
||||||
public ImageSource imageSource_oculta;
|
public ImageSource imageSource_oculta;
|
||||||
|
|
||||||
private void OnImagePathChanged(string value)
|
private void OnImagePathChanged(string value)
|
||||||
|
|
|
@ -34,8 +34,8 @@ namespace CtrEditor.ObjetosSim
|
||||||
set => SetProperty(ref nombre, value);
|
set => SetProperty(ref nombre, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[property: JsonIgnore]
|
||||||
public ImageSource imageSource_oculta;
|
public ImageSource imageSource_oculta;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
@ -222,9 +222,9 @@ namespace CtrEditor.ObjetosSim
|
||||||
else
|
else
|
||||||
Data.Actual_Position = 0;
|
Data.Actual_Position = 0;
|
||||||
|
|
||||||
// Read ControlWord and track the raw response
|
// Read ControlWord and track the raw response
|
||||||
var rawResponse = plc.LeerTagDInt($"\"DB MotorSimulate\".Motors[{DB_Motor}].ControlWord");
|
var rawResponse = plc.LeerTagDInt($"\"DB MotorSimulate\".Motors[{DB_Motor}].ControlWord");
|
||||||
int controlWord = rawResponse ?? 0;
|
int controlWord = rawResponse ?? 0;
|
||||||
var control = VMMotorBitPacker.UnpackControlWord(controlWord);
|
var control = VMMotorBitPacker.UnpackControlWord(controlWord);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@ namespace CtrEditor.ObjetosSim
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
private System.Threading.Timer timer = null;
|
private System.Threading.Timer timer = null;
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[property: JsonIgnore]
|
||||||
[property: Hidden]
|
[property: Hidden]
|
||||||
public bool isVisFilter;
|
public bool isVisFilter;
|
||||||
|
|
||||||
|
@ -344,28 +344,28 @@ namespace CtrEditor.ObjetosSim
|
||||||
private bool isUpdatingFromFramePlate = false;
|
private bool isUpdatingFromFramePlate = false;
|
||||||
|
|
||||||
// Variables para rotación orbital alrededor del FramePlate
|
// Variables para rotación orbital alrededor del FramePlate
|
||||||
[JsonIgnore]
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[property: JsonIgnore]
|
||||||
[property: Hidden]
|
[property: Hidden]
|
||||||
private float framePlate_RelativeX;
|
private float framePlate_RelativeX;
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[property: JsonIgnore]
|
||||||
[property: Hidden]
|
[property: Hidden]
|
||||||
private float framePlate_RelativeY;
|
private float framePlate_RelativeY;
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[property: JsonIgnore]
|
||||||
[property: Hidden]
|
[property: Hidden]
|
||||||
private float framePlate_InitialAngle;
|
private float framePlate_InitialAngle;
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[property: JsonIgnore]
|
||||||
[property: Hidden]
|
[property: Hidden]
|
||||||
private float framePlate_PivotX;
|
private float framePlate_PivotX;
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
[property: JsonIgnore]
|
||||||
[property: Hidden]
|
[property: Hidden]
|
||||||
private float framePlate_PivotY;
|
private float framePlate_PivotY;
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,12 @@ namespace CtrEditor.Serialization
|
||||||
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||||
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
|
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
|
||||||
Error = HandleDeserializationError,
|
Error = HandleDeserializationError,
|
||||||
Converters = { new SafeImageSourceConverter() }
|
Converters = { new SafeImageSourceConverter() },
|
||||||
|
// Configuración para respetar atributos JsonIgnore de Newtonsoft.Json
|
||||||
|
ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver
|
||||||
|
{
|
||||||
|
IgnoreSerializableAttribute = false
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue