- adding a lot of english translations
- switching german to english - some bug fixes in device sessions and improvements - adding xml documentation
This commit is contained in:
@@ -8,6 +8,9 @@ using TelegramBotBase.Base;
|
||||
|
||||
namespace TelegramBotBase.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple prompt dialog with one ok Button
|
||||
/// </summary>
|
||||
public class AlertDialog : PromptDialog
|
||||
{
|
||||
public String ButtonText { get; set; }
|
||||
|
||||
@@ -8,6 +8,9 @@ using TelegramBotBase.Base;
|
||||
|
||||
namespace TelegramBotBase.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// A prompt with a lot of buttons
|
||||
/// </summary>
|
||||
public class ArrayPromptDialog : FormBase
|
||||
{
|
||||
public String Message { get; set; }
|
||||
|
||||
@@ -8,6 +8,9 @@ using TelegramBotBase.Base;
|
||||
|
||||
namespace TelegramBotBase.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// A form which cleans up old messages sent within
|
||||
/// </summary>
|
||||
public class AutoCleanForm : FormBase
|
||||
{
|
||||
List<Message> OldMessages { get; set; }
|
||||
@@ -16,8 +19,9 @@ namespace TelegramBotBase.Form
|
||||
|
||||
public enum eDeleteMode
|
||||
{
|
||||
OnEveryCall = 0,
|
||||
OnLeavingForm = 1
|
||||
None = 0,
|
||||
OnEveryCall = 1,
|
||||
OnLeavingForm = 2
|
||||
}
|
||||
|
||||
public AutoCleanForm()
|
||||
|
||||
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace TelegramBotBase.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for button handling
|
||||
/// </summary>
|
||||
public class ButtonBase
|
||||
{
|
||||
public String Text { get; set; }
|
||||
|
||||
@@ -7,6 +7,9 @@ using Telegram.Bot.Types.ReplyMarkups;
|
||||
|
||||
namespace TelegramBotBase.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for an buttons array
|
||||
/// </summary>
|
||||
public class ButtonForm
|
||||
{
|
||||
List<List<ButtonBase>> Buttons = new List<List<ButtonBase>>();
|
||||
@@ -47,7 +50,7 @@ namespace TelegramBotBase.Form
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fügt die Buttons automatisch aufgesplittet in Spalten ein.
|
||||
/// Add buttons splitted in the amount of columns (i.e. 2 per row...)
|
||||
/// </summary>
|
||||
/// <param name="buttons"></param>
|
||||
/// <param name="buttonsPerRow"></param>
|
||||
|
||||
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace TelegramBotBase.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for serializing buttons and data
|
||||
/// </summary>
|
||||
public class CallbackData
|
||||
{
|
||||
public String Method { get; set; }
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TelegramBotBase.Base;
|
||||
using TelegramBotBase.Sessions;
|
||||
|
||||
namespace TelegramBotBase.Form
|
||||
{
|
||||
public class FormBase : IDisposable
|
||||
{
|
||||
public DeviceSession Device { get; set; }
|
||||
|
||||
public MessageClient Client { get; set; }
|
||||
|
||||
public bool CustomEventManagement { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gibt an, dass das Formular gewechselt wurde, es werden keine weiteren Events ausgeführt
|
||||
/// </summary>
|
||||
public bool FormSwitched { get; set; } = false;
|
||||
|
||||
public List<ControlBase> Controls { get; set; }
|
||||
|
||||
public FormBase()
|
||||
{
|
||||
this.Controls = new List<Base.ControlBase>();
|
||||
}
|
||||
|
||||
public FormBase(MessageClient Client): this()
|
||||
{
|
||||
this.Client = Client;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wird nur aufgerufen, beim erstmaligen Laden des Formulares.
|
||||
/// </summary>
|
||||
public virtual async Task Init(params object[] args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual async Task Opened()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual async Task Closed()
|
||||
{
|
||||
foreach (var b in this.Controls)
|
||||
{
|
||||
await b.Cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual async Task PreLoad(MessageResult message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual async Task Load(MessageResult message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual async Task Action(MessageResult message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public virtual async Task Render(MessageResult message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Navigiert zur neuen Form.
|
||||
///// </summary>
|
||||
///// <param name="newForm"></param>
|
||||
///// <returns></returns>
|
||||
//public async Task NavigateTo(FormBase newForm)
|
||||
//{
|
||||
// DeviceSession ds = this.Device;
|
||||
// if (ds == null)
|
||||
// return;
|
||||
|
||||
// this.FormSwitched = true;
|
||||
|
||||
// ds.ActiveForm = newForm;
|
||||
// newForm.Client = this.Client;
|
||||
// newForm.Device = ds;
|
||||
|
||||
// await this.Closed();
|
||||
|
||||
// await newForm.Opened();
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Navigiert zur neuen Form.
|
||||
/// </summary>
|
||||
/// <param name="newForm"></param>
|
||||
/// <returns></returns>
|
||||
public async Task NavigateTo(FormBase newForm, params object[] args)
|
||||
{
|
||||
DeviceSession ds = this.Device;
|
||||
if (ds == null)
|
||||
return;
|
||||
|
||||
this.FormSwitched = true;
|
||||
|
||||
ds.ActiveForm = newForm;
|
||||
newForm.Client = this.Client;
|
||||
newForm.Device = ds;
|
||||
|
||||
await newForm.Init(args);
|
||||
|
||||
await this.Closed();
|
||||
|
||||
await newForm.Opened();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.Client = null;
|
||||
this.Device = null;
|
||||
this.FormSwitched = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user