CtrEditor/ObjetosSim/osBase.cs

72 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Windows.Controls;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace CtrEditor.ObjetosSim
{
public interface IosBase
{
string Nombre { get; }
void ConnectSimManager(SimulationManager simulationManager);
void UpdateControl();
}
public interface IDataContainer
{
osBase? Datos { get; set; }
void Resize(float width, float height);
void Move(float Left, float Top);
void Rotate(float Angle);
void Highlight(bool State);
}
public abstract class osBase : INotifyPropertyChanged, IosBase
{
private string _nombre = "Base";
public abstract float Left { get; set; }
public abstract float Top { get; set; }
public bool Inicializado = false;
protected UserControl? _visualRepresentation = null;
public string Nombre
{
get => _nombre;
set
{
if (_nombre != value)
{
_nombre = value;
OnPropertyChanged(nameof(Nombre));
}
}
}
public abstract void ConnectSimManager(SimulationManager simulationManager);
public abstract void UpdateControl();
[JsonIgnore]
public UserControl? VisualRepresentation
{
get => _visualRepresentation;
set => _visualRepresentation = value;
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}