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 LibS7Adv;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using CtrEditor.FuncionesBase;
|
||||
using System.ComponentModel;
|
||||
|
@ -75,8 +75,8 @@ namespace CtrEditor.ObjetosSim
|
|||
private bool vertical_Flip;
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
public ImageSource imageSource_oculta;
|
||||
|
||||
private void OnImagePathChanged(string value)
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace CtrEditor.ObjetosSim
|
|||
set => SetProperty(ref nombre, value);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
public ImageSource imageSource_oculta;
|
||||
|
||||
[ObservableProperty]
|
||||
|
@ -222,9 +222,9 @@ namespace CtrEditor.ObjetosSim
|
|||
else
|
||||
Data.Actual_Position = 0;
|
||||
|
||||
// Read ControlWord and track the raw response
|
||||
var rawResponse = plc.LeerTagDInt($"\"DB MotorSimulate\".Motors[{DB_Motor}].ControlWord");
|
||||
int controlWord = rawResponse ?? 0;
|
||||
// Read ControlWord and track the raw response
|
||||
var rawResponse = plc.LeerTagDInt($"\"DB MotorSimulate\".Motors[{DB_Motor}].ControlWord");
|
||||
int controlWord = rawResponse ?? 0;
|
||||
var control = VMMotorBitPacker.UnpackControlWord(controlWord);
|
||||
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ namespace CtrEditor.ObjetosSim
|
|||
[JsonIgnore]
|
||||
private System.Threading.Timer timer = null;
|
||||
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
[property: Hidden]
|
||||
public bool isVisFilter;
|
||||
|
||||
|
@ -344,28 +344,28 @@ namespace CtrEditor.ObjetosSim
|
|||
private bool isUpdatingFromFramePlate = false;
|
||||
|
||||
// Variables para rotación orbital alrededor del FramePlate
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
[property: Hidden]
|
||||
private float framePlate_RelativeX;
|
||||
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
[property: Hidden]
|
||||
private float framePlate_RelativeY;
|
||||
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
[property: Hidden]
|
||||
private float framePlate_InitialAngle;
|
||||
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
[property: Hidden]
|
||||
private float framePlate_PivotX;
|
||||
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
[property: JsonIgnore]
|
||||
[property: Hidden]
|
||||
private float framePlate_PivotY;
|
||||
|
||||
|
|
|
@ -257,7 +257,12 @@ namespace CtrEditor.Serialization
|
|||
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
|
||||
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