65 lines
1011 B
C#

namespace MBS.Desktop.Controls;
public class Label : Control
{
public interface IImplementation
{
string GetText();
void SetText(string value);
bool GetUseMarkup();
void SetUseMarkup(bool value);
}
public Label()
{
}
public Label(string text)
{
this.Text = text;
}
protected override void InitializeImplementedProperties()
{
base.InitializeImplementedProperties();
Text = _Text;
UseMarkup = _UseMarkup;
}
private string _Text = null;
public string Text
{
get
{
if (Implementation is IImplementation impl)
{
_Text = impl.GetText();
}
return _Text;
}
set
{
_Text = value;
(Implementation as IImplementation)?.SetText(value);
}
}
private bool _UseMarkup = false;
public bool UseMarkup
{
get
{
if (Implementation is IImplementation impl)
{
_UseMarkup = impl.GetUseMarkup();
}
return _UseMarkup;
}
set
{
_UseMarkup = value;
(Implementation as IImplementation)?.SetUseMarkup(value);
}
}
}