- 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
55 lines
948 B
C#
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()
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
}
|