Untitled
unknown
plain_text
2 years ago
12 kB
7
Indexable
using System;
using System.ComponentModel;
using System.Text;
namespace PromEnergoUI.Engine.Model.Passport
{
public class Model : INotifyPropertyChanged
{
protected object? meterVersion;
protected object? serialNumber;
protected object? deviceType;
protected object? metrologyVersionApp;
protected object? manufacturerName;
protected object? dateOfProduction;
protected object? versionSPODESSpecification;
protected object? nominalVoltage;
protected object? nominalCurrent;
protected object? nominalFrequency;
protected object? maxCurrent;
protected object? referenceVoltage;
protected object? pulseConstantA;
protected object? pulseConstantR;
protected object? currentCoefficient;
protected object? voltageCoefficient;
protected string? digitalSoftwareIdent;
protected string? softwareIdentName;
public virtual string DigitalSoftwareIdent
{
get => digitalSoftwareIdent;
set
{
if(value != null)
{
digitalSoftwareIdent = value;
OnPropertyChanged(nameof(DigitalSoftwareIdent));
}
}
}
public virtual string SoftwareIdentName
{
get => softwareIdentName;
set
{
if (value != null)
{
softwareIdentName = value;
OnPropertyChanged(nameof(SoftwareIdentName));
}
}
}
public virtual object MeterVersion
{
get
{
byte[] result = (byte[])meterVersion;
return (byte[])meterVersion == null ? "" : Encoding.ASCII.GetString(result);
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.meterVersion)) return;
else
{
this.meterVersion = value;
OnPropertyChanged(nameof(MeterVersion));
}
}
}
public virtual object SerialNumber
{
get
{
byte[] result = (byte[])serialNumber;
return (byte[])serialNumber == null ? "" : Encoding.ASCII.GetString(result);
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.serialNumber)) return;
else
{
this.serialNumber = value;
OnPropertyChanged(nameof(SerialNumber));
}
}
}
public virtual object DeviceType
{
get
{
byte[] result = (byte[])deviceType;
return (byte[])deviceType == null ? "" : Encoding.ASCII.GetString(result);
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.deviceType)) return;
else
{
this.deviceType = value;
if (value.ToString().Contains('1'))
{
DigitalSoftwareIdent = "0хE445D3AD";
SoftwareIdentName = "metrolody_1ph_meter.hex";
}
else
{
DigitalSoftwareIdent = "0х7C0AA4F8";
SoftwareIdentName = "metrolody_3ph_meter.hex";
}
OnPropertyChanged(nameof(DeviceType));
}
}
}
public virtual object MetrologyVersionApp
{
get
{
byte[] result = (byte[])metrologyVersionApp;
return (byte[])metrologyVersionApp == null ? "" : Encoding.ASCII.GetString(result);
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.metrologyVersionApp)) return;
else
{
this.metrologyVersionApp = value;
OnPropertyChanged(nameof(MetrologyVersionApp));
}
}
}
public virtual object ManufacturerName
{
get
{
byte[] result = (byte[])manufacturerName;
return (byte[])manufacturerName == null ? "" : Encoding.ASCII.GetString(result);
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.manufacturerName)) return;
else
{
this.manufacturerName = value;
OnPropertyChanged(nameof(ManufacturerName));
}
}
}
public virtual object DateOfProduction
{
get
{
byte[] result = (byte[])dateOfProduction;
return (byte[])dateOfProduction == null ? "" : Encoding.ASCII.GetString(result);
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.dateOfProduction)) return;
else
{
this.dateOfProduction = value;
OnPropertyChanged(nameof(DateOfProduction));
}
}
}
public virtual object VersionSPODESSpecification
{
get
{
byte[] result = (byte[])versionSPODESSpecification;
return (byte[])versionSPODESSpecification == null ? "" : Encoding.ASCII.GetString(result);
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.versionSPODESSpecification)) return;
else
{
this.versionSPODESSpecification = value;
OnPropertyChanged(nameof(VersionSPODESSpecification));
}
}
}
public virtual object NominalVoltage
{
get
{
var result = (this.nominalVoltage == null) ? String.Empty : this.nominalVoltage.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.nominalVoltage)) return;
else
{
this.nominalVoltage = value;
OnPropertyChanged(nameof(NominalVoltage));
}
}
}
public object? NominalVoltageScaler { get; set; }
public virtual object NominalCurrent
{
get
{
var result = (this.nominalCurrent == null) ? String.Empty : this.nominalCurrent.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.nominalCurrent)) return;
else
{
this.nominalCurrent = value;
OnPropertyChanged(nameof(NominalCurrent));
}
}
}
public object? NominalCurrentScaler { get; set; }
public virtual object NominalFrequency
{
get
{
var result = (this.nominalFrequency == null) ? String.Empty : this.nominalFrequency.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.nominalFrequency)) return;
else
{
this.nominalFrequency = value;
OnPropertyChanged(nameof(NominalFrequency));
}
}
}
public object? NominalFrequencyScaler { get; set; }
public virtual object MaxCurrent
{
get
{
var result = (this.maxCurrent == null) ? String.Empty : this.maxCurrent.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.maxCurrent)) return;
else
{
this.maxCurrent = value;
OnPropertyChanged(nameof(MaxCurrent));
}
}
}
public object? MaxCurrentScaler { get; set; }
public virtual object ReferenceVoltage
{
get
{
var result = (this.referenceVoltage == null) ? String.Empty : this.referenceVoltage.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.referenceVoltage)) return;
else
{
this.referenceVoltage = value;
OnPropertyChanged(nameof(ReferenceVoltage));
}
}
}
public object? ReferenceVoltageScaler { get; set; }
public virtual object PulseConstantA
{
get
{
var result = (this.pulseConstantA == null) ? String.Empty : this.pulseConstantA.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.pulseConstantA)) return;
else
{
this.pulseConstantA = value;
OnPropertyChanged(nameof(PulseConstantA));
}
}
}
public virtual object PulseConstantR
{
get
{
var result = (this.pulseConstantR == null) ? String.Empty : this.pulseConstantR.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.pulseConstantR)) return;
else
{
this.pulseConstantR = value;
OnPropertyChanged(nameof(PulseConstantR));
}
}
}
public virtual object CurrentCoefficient
{
get
{
var result = (this.currentCoefficient == null) ? String.Empty : this.currentCoefficient.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.currentCoefficient)) return;
else
{
this.currentCoefficient = value;
OnPropertyChanged(nameof(CurrentCoefficient));
}
}
}
public virtual object VoltageCoefficient
{
get
{
var result = (this.voltageCoefficient == null) ? String.Empty : this.voltageCoefficient.ToString();
return result;
}
set
{
if (value == null) return;
if (value.ToString().Equals(this.voltageCoefficient)) return;
else
{
this.voltageCoefficient = value;
OnPropertyChanged(nameof(VoltageCoefficient));
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Editor is loading...