74 lines
1.9 KiB
C#
74 lines
1.9 KiB
C#
using System.ComponentModel;
|
|
|
|
namespace S7Explorer.Models
|
|
{
|
|
public class S7Symbol : S7Object
|
|
{
|
|
private string _address;
|
|
private string _dataType;
|
|
private string _comment;
|
|
|
|
[DisplayName("Dirección")]
|
|
public string Address
|
|
{
|
|
get => _address;
|
|
set
|
|
{
|
|
if (_address != value)
|
|
{
|
|
_address = value;
|
|
OnPropertyChanged(nameof(Address));
|
|
}
|
|
}
|
|
}
|
|
|
|
[DisplayName("Tipo de Datos")]
|
|
public string DataType
|
|
{
|
|
get => _dataType;
|
|
set
|
|
{
|
|
if (_dataType != value)
|
|
{
|
|
_dataType = value;
|
|
OnPropertyChanged(nameof(DataType));
|
|
}
|
|
}
|
|
}
|
|
|
|
[DisplayName("Comentario")]
|
|
public string Comment
|
|
{
|
|
get => _comment;
|
|
set
|
|
{
|
|
if (_comment != value)
|
|
{
|
|
_comment = value;
|
|
OnPropertyChanged(nameof(Comment));
|
|
}
|
|
}
|
|
}
|
|
|
|
public S7Symbol()
|
|
{
|
|
ObjectType = S7ObjectType.Symbol;
|
|
}
|
|
|
|
// Sobrescribe el método de búsqueda de texto para incluir dirección y tipo de datos
|
|
public new bool ContainsText(string searchText)
|
|
{
|
|
if (base.ContainsText(searchText))
|
|
return true;
|
|
|
|
if (string.IsNullOrWhiteSpace(searchText))
|
|
return false;
|
|
|
|
searchText = searchText.ToLowerInvariant();
|
|
|
|
return Address?.ToLowerInvariant().Contains(searchText) == true ||
|
|
DataType?.ToLowerInvariant().Contains(searchText) == true ||
|
|
Comment?.ToLowerInvariant().Contains(searchText) == true;
|
|
}
|
|
}
|
|
} |