S7Explorer/Models/S7Block.cs

161 lines
3.6 KiB
C#

using System;
using System.ComponentModel;
namespace S7Explorer.Models
{
public class S7Block : S7Object
{
private string _authorName;
private string _family;
private string _version;
private DateTime? _modified;
private int _size;
[DisplayName("Autor")]
public string AuthorName
{
get => _authorName;
set
{
if (_authorName != value)
{
_authorName = value;
OnPropertyChanged(nameof(AuthorName));
}
}
}
[DisplayName("Familia")]
public string Family
{
get => _family;
set
{
if (_family != value)
{
_family = value;
OnPropertyChanged(nameof(Family));
}
}
}
[DisplayName("Versión")]
public string Version
{
get => _version;
set
{
if (_version != value)
{
_version = value;
OnPropertyChanged(nameof(Version));
}
}
}
[DisplayName("Modificado")]
public DateTime? Modified
{
get => _modified;
set
{
if (_modified != value)
{
_modified = value;
OnPropertyChanged(nameof(Modified));
}
}
}
[DisplayName("Tamaño (bytes)")]
public int Size
{
get => _size;
set
{
if (_size != value)
{
_size = value;
OnPropertyChanged(nameof(Size));
}
}
}
public S7Block()
{
// Establece valores predeterminados específicos para bloques
}
}
public class S7DataBlock : S7Block
{
private bool _instanceDb;
[DisplayName("Es DB de Instancia")]
public bool IsInstanceDb
{
get => _instanceDb;
set
{
if (_instanceDb != value)
{
_instanceDb = value;
OnPropertyChanged(nameof(IsInstanceDb));
}
}
}
public S7DataBlock()
{
ObjectType = S7ObjectType.DataBlock;
}
}
public class S7FunctionBlock : S7Block
{
private string _language;
[DisplayName("Lenguaje")]
public string Language
{
get => _language;
set
{
if (_language != value)
{
_language = value;
OnPropertyChanged(nameof(Language));
}
}
}
public S7FunctionBlock()
{
ObjectType = S7ObjectType.FunctionBlock;
}
}
public class S7Function : S7Block
{
private string _returnType;
[DisplayName("Tipo de Retorno")]
public string ReturnType
{
get => _returnType;
set
{
if (_returnType != value)
{
_returnType = value;
OnPropertyChanged(nameof(ReturnType));
}
}
}
public S7Function()
{
ObjectType = S7ObjectType.Function;
}
}
}