1414
1515** Releases: [ GitHub] ( https://github.com/MajMcCloud/TelegramBotFramework/releases ) **
1616
17+ ** Need your own bot? Get in touch https://t.me/botbasebuilder **
18+
19+ ** on X: @florian_zevedei**
20+
1721## Donate
1822
1923Paypal: [ https://paypal.me/majmccloud ] ( https://paypal.me/majmccloud )
@@ -109,6 +113,7 @@ var bot = BotBaseBuilder
109113 })
110114 .NoSerialization ()
111115 .UseEnglish ()
116+ .UseSingleThread ()
112117 .Build ();
113118
114119// Upload bot commands to BotFather
@@ -129,8 +134,32 @@ like ChatId and other stuff your carrying.
129134From there you build up your bots:
130135
131136``` csharp
132- public class StartForm : FormBase
137+ public class Start : FormBase
133138{
139+
140+ public Start ()
141+ {
142+ // Additional event handlers
143+ Init += Start_Init ;
144+ Opened += Start_Opened ;
145+ Closed += Start_Closed ;
146+ }
147+
148+ // Gets invoked on initialization, before navigation
149+ private async Task Start_Init (object sender , Args.InitEventArgs e )
150+ {
151+ }
152+
153+ // Gets invoked after opened
154+ private async Task Start_Opened (object sender , EventArgs e )
155+ {
156+ }
157+
158+ // Gets invoked after form has been closed
159+ private async Task Start_Closed (object sender , EventArgs e )
160+ {
161+ }
162+
134163 // Gets invoked during Navigation to this form
135164 public override async Task PreLoad (MessageResult message )
136165 {
@@ -227,6 +256,7 @@ var bot = BotBaseBuilder
227256 })
228257 .NoSerialization ()
229258 .UseEnglish ()
259+ .UseSingleThread ()
230260 .Build ();
231261
232262bot .BotCommand += async (s , en ) =>
@@ -267,15 +297,15 @@ public class SimpleForm : AutoCleanForm
267297{
268298 public SimpleForm ()
269299 {
270- this . DeleteSide = TelegramBotBase . Enums . eDeleteSide .Both ;
271- this . DeleteMode = TelegramBotBase . Enums . eDeleteMode .OnLeavingForm ;
300+ DeleteSide = EDeleteSide .Both ;
301+ DeleteMode = EDeleteMode .OnLeavingForm ;
272302
273- this . Opened += SimpleForm_Opened ;
303+ Opened += SimpleForm_Opened ;
274304 }
275305
276306 private async Task SimpleForm_Opened (object sender , EventArgs e )
277307 {
278- await this . Device .Send (" Hello world! (send 'back' to get back to Start)\r\n Or\r\n hi, hello, maybe, bye and ciao" );
308+ await Device .Send (" Hello world! (send 'back' to get back to Start)\r\n Or\r\n hi, hello, maybe, bye and ciao" );
279309 }
280310
281311 public override async Task Load (MessageResult message )
@@ -313,7 +343,13 @@ public class SimpleForm : AutoCleanForm
313343``` csharp
314344public class ButtonTestForm : AutoCleanForm
315345{
316- public override async Task Opened ()
346+ public ButtonTestForm ()
347+ {
348+ this .DeleteMode = eDeleteMode .OnLeavingForm ;
349+ Opened += ButtonTestForm_Opened ;
350+ }
351+
352+ private async Task ButtonTestForm_Opened (object sender , EventArgs e )
317353 {
318354 await this .Device .Send (" Hello world! (Click 'back' to get back to Start)" );
319355 }
@@ -383,9 +419,10 @@ public class ProgressTest : AutoCleanForm
383419 public ProgressTest ()
384420 {
385421 this .DeleteMode = eDeleteMode .OnLeavingForm ;
422+ Opened += ProgressTest_Opened ;
386423 }
387424
388- public override async Task Opened ( )
425+ private async Task ProgressTest_Opened ( object sender , EventArgs e )
389426 {
390427 await this .Device .Send (" Welcome to ProgressTest" );
391428 }
@@ -866,6 +903,7 @@ var bot = BotBaseBuilder
866903 })
867904 .UseSimpleJSON (AppContext .BaseDirectory + " config\\ states.json" )
868905 .UseEnglish ()
906+ .UseSingleThread ()
869907 .Build ();
870908
871909await bot .Start ();
@@ -889,6 +927,7 @@ var bot = BotBaseBuilder
889927 })
890928 .UseJSON (AppContext .BaseDirectory + " config\\ states.json" )
891929 .UseEnglish ()
930+ .UseSingleThread ()
892931 .Build ();
893932
894933await bot .Start ();
@@ -911,6 +950,7 @@ var bot = BotBaseBuilder
911950 })
912951 .UseXML (AppContext .BaseDirectory + " config\\ states.xml" )
913952 .UseEnglish ()
953+ .UseSingleThread ()
914954 .Build ();
915955
916956await bot .Start ();
@@ -924,7 +964,7 @@ datatype and one for implementing into a form which should be invoked with event
924964#### IStateMachine
925965
926966Is the basic StateMachine interface, it has two methods ` SaveFormStates(SaveStatesEventArgs e) `
927- and ` StateContainerLoadFormStates ()` , nothing fancy, just simple calls. Implement both methods with your own
967+ and ` LoadFormStates ()` , nothing fancy, just simple calls. Implement both methods with your own
928968serialization process.
929969
930970``` csharp
0 commit comments