- Update of FormBase for better async event management

- Update of ControlBase for partial rendering options
- Updating serveral base classes to better asyc event management
- separating Enums into different folder
- some small bug fixes
- removed "CustomEventManagement" cause it doesnt make sense now
This commit is contained in:
FlorianDahn
2019-07-14 22:22:04 +02:00
parent cb4a797b12
commit e4da70d37d
17 changed files with 404 additions and 103 deletions
+37 -20
View File
@@ -127,11 +127,7 @@ namespace TelegramBotBase.Sessions
if (this.ActiveForm == null)
return null;
InlineKeyboardMarkup markup = null;
if (buttons != null)
{
markup = buttons;
}
InlineKeyboardMarkup markup = buttons;
try
{
@@ -160,11 +156,7 @@ namespace TelegramBotBase.Sessions
if (this.ActiveForm == null)
return null;
InlineKeyboardMarkup markup = null;
if (buttons != null)
{
markup = buttons;
}
InlineKeyboardMarkup markup = buttons;
try
{
@@ -194,11 +186,7 @@ namespace TelegramBotBase.Sessions
if (this.ActiveForm == null)
return null;
InlineKeyboardMarkup markup = null;
if (buttons != null)
{
markup = buttons;
}
InlineKeyboardMarkup markup = buttons;
Message m = null;
@@ -253,6 +241,39 @@ namespace TelegramBotBase.Sessions
return m;
}
/// <summary>
/// Sends a simple text message
/// </summary>
/// <param name="text"></param>
/// <param name="markup"></param>
/// <param name="replyTo"></param>
/// <param name="disableNotification"></param>
/// <returns></returns>
public async Task<Message> Send(String text, ReplyKeyboardMarkup markup, int replyTo = 0, bool disableNotification = false)
{
if (this.ActiveForm == null)
return null;
Message m = null;
try
{
m = await (this.Client.TelegramClient.SendTextMessageAsync(this.DeviceId, text, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification));
OnMessageSent(new MessageSentEventArgs(m));
}
catch (ApiRequestException ex)
{
return null;
}
catch
{
return null;
}
return m;
}
/// <summary>
/// Sends an image
/// </summary>
@@ -266,11 +287,7 @@ namespace TelegramBotBase.Sessions
if (this.ActiveForm == null)
return null;
InlineKeyboardMarkup markup = null;
if (buttons != null)
{
markup = buttons;
}
InlineKeyboardMarkup markup = buttons;
Message m = null;