FlorianDahn 56c7754408 - Added ToggleButton as an easy switch control (i.e. for settings page)
- added control id, for easier separating of controls in one form
- added automatic event selection for specific controls, to not raise an event for other controls who has invoked it
- changed Action method
- added example
2019-08-23 14:02:24 +02:00

55 lines
948 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TelegramBotBase.Base
{
/// <summary>
/// Base class for controls
/// </summary>
public class ControlBase
{
public Sessions.DeviceSession Device { get; set; }
public int ID { get; set; }
public String ControlID
{
get
{
return "#c" + this.ID.ToString();
}
}
/// <summary>
/// Defines if the control should be rendered and invoked with actions
/// </summary>
public bool Enabled { get; set; } = true;
public virtual async Task Action(MessageResult result, String value = null)
{
}
public virtual async Task Render(MessageResult result)
{
}
public virtual async Task Cleanup()
{
}
}
}