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 Update(); } public interface IDataContainer { osBase? Datos { get; set; } void Resize(double width, double height); void Move(double Left, double Top); void Rotate(double Angle); } public abstract class osBase : INotifyPropertyChanged, IosBase { private string _nombre = "Base"; public double _left; public double _top; public bool Inicializado = false; public double Left { get => _left; set { _left = value; if (_visualRepresentation != null) Canvas.SetLeft(_visualRepresentation, _left); OnPropertyChanged(nameof(Left)); } } public double Top { get => _top; set { _top = value; if (_visualRepresentation != null) Canvas.SetTop(_visualRepresentation, _top); OnPropertyChanged(nameof(Top)); } } private UserControl? _visualRepresentation = null; public string Nombre { get => _nombre; set { if (_nombre != value) { _nombre = value; OnPropertyChanged(nameof(Nombre)); } } } public abstract void Update(); [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)); } } }