- Cleanup of unecessary init calls
- added form1/form2 option to start menu in test project - added example for different forms with and without event handlers - added form examples to Readme.md
This commit is contained in:
@@ -59,8 +59,6 @@ namespace TelegramBaseTest.Tests
|
||||
|
||||
var st = new Start();
|
||||
|
||||
await st.Init();
|
||||
|
||||
await this.NavigateTo(st);
|
||||
|
||||
break;
|
||||
|
||||
@@ -75,8 +75,6 @@ namespace TelegramBaseTest.Tests
|
||||
|
||||
var sf = new Start();
|
||||
|
||||
await sf.Init();
|
||||
|
||||
await this.NavigateTo(sf);
|
||||
|
||||
return;
|
||||
|
||||
@@ -50,8 +50,6 @@ namespace TelegramBaseTest.Tests
|
||||
|
||||
var st = new Start();
|
||||
|
||||
await st.Init();
|
||||
|
||||
await this.NavigateTo(st);
|
||||
|
||||
break;
|
||||
|
||||
@@ -53,6 +53,22 @@ namespace TelegramBaseTest.Tests
|
||||
|
||||
await this.NavigateTo(reg);
|
||||
|
||||
break;
|
||||
|
||||
case "form1":
|
||||
|
||||
var form1 = new TestForm();
|
||||
|
||||
await this.NavigateTo(form1);
|
||||
|
||||
break;
|
||||
|
||||
case "form2":
|
||||
|
||||
var form2 = new TestForm2();
|
||||
|
||||
await this.NavigateTo(form2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -68,6 +84,10 @@ namespace TelegramBaseTest.Tests
|
||||
btn.AddButtonRow(new ButtonBase("#3 Progress Bar", new CallbackData("a", "progress").Serialize()));
|
||||
btn.AddButtonRow(new ButtonBase("#4 Registration Example", new CallbackData("a", "registration").Serialize()));
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("#5 Form1 Command", new CallbackData("a", "form1").Serialize()));
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("#6 Form2 Command", new CallbackData("a", "form2").Serialize()));
|
||||
|
||||
await this.Device.Send("Choose your test:", btn);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,6 @@ namespace TelegramBaseTest.Tests
|
||||
|
||||
var tf = new TestForm2();
|
||||
|
||||
await tf.Init();
|
||||
|
||||
await this.NavigateTo(tf);
|
||||
|
||||
break;
|
||||
|
||||
@@ -48,18 +48,14 @@ namespace TelegramBaseTest.Tests
|
||||
|
||||
var tf = new TestForm();
|
||||
|
||||
await tf.Init();
|
||||
|
||||
await this.NavigateTo(tf);
|
||||
}
|
||||
else if (call.Value == "alert")
|
||||
{
|
||||
var fto = new TestForm2();
|
||||
await fto.Init();
|
||||
|
||||
AlertDialog ad = new AlertDialog("This is a message", "Ok", fto);
|
||||
|
||||
|
||||
|
||||
await this.NavigateTo(ad);
|
||||
}
|
||||
else if (call.Value == "prompt")
|
||||
@@ -68,10 +64,24 @@ namespace TelegramBaseTest.Tests
|
||||
|
||||
var tf = new TestForm2();
|
||||
|
||||
await tf.Init();
|
||||
|
||||
pd.ButtonForms.Add("ok", tf);
|
||||
pd.ButtonForms.Add("cancel", tf);
|
||||
|
||||
await this.NavigateTo(pd);
|
||||
}
|
||||
else if (call.Value == "promptevt")
|
||||
{
|
||||
PromptDialog pd = new PromptDialog("Please confirm", new ButtonBase("Ok", "ok"), new ButtonBase("Cancel", "cancel"));
|
||||
|
||||
pd.ButtonForms.Add("ok", null);
|
||||
pd.ButtonForms.Add("cancel", null);
|
||||
|
||||
pd.ButtonClicked += async (s, en) =>
|
||||
{
|
||||
var tf = new TestForm2();
|
||||
|
||||
await pd.NavigateTo(tf);
|
||||
};
|
||||
|
||||
await this.NavigateTo(pd);
|
||||
}
|
||||
@@ -98,7 +108,11 @@ namespace TelegramBaseTest.Tests
|
||||
|
||||
//btn.AddButtonRow(new ButtonBase("Zum Testformular 1", CallbackData.Create("navigate", "testform1")), new ButtonBase("Zum Testformular 1", CallbackData.Create("navigate", "testform1")));
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("Information Prompt", CallbackData.Create("navigate", "alert")), new ButtonBase("Confirmation Prompt", CallbackData.Create("navigate", "prompt")));
|
||||
btn.AddButtonRow(new ButtonBase("Information Prompt", CallbackData.Create("navigate", "alert")));
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("Confirmation Prompt without event", CallbackData.Create("navigate", "prompt")));
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("Confirmation Prompt with event", CallbackData.Create("navigate", "promptevt")));
|
||||
|
||||
|
||||
await this.Device.SendPhoto(bmp, "Test", btn);
|
||||
|
||||
Reference in New Issue
Block a user