Update Readme.md

This commit is contained in:
FlorianDahn 2019-03-20 17:51:40 +07:00
commit 46c1acbf99

118
README.md
View File

@ -157,16 +157,16 @@ Below we have 4 options.
```
BotBase<Start> bb = new BotBase<Start>("{YOUR API KEY}");
BotBase<Start> bb = new BotBase<Start>("{YOUR API KEY}");
bb.SystemCalls.Add("/start");
bb.SystemCalls.Add("/form1");
bb.SystemCalls.Add("/form2");
bb.SystemCalls.Add("/start");
bb.SystemCalls.Add("/form1");
bb.SystemCalls.Add("/form2");
bb.SystemCalls.Add("/params");
bb.SystemCalls.Add("/params");
bb.SystemCall += async (s, en) =>
{
bb.SystemCall += async (s, en) =>
{
switch (en.Command)
{
case "/form1":
@ -194,9 +194,9 @@ Below we have 4 options.
break;
}
};
};
bb.Start();
bb.Start();
```
@ -247,8 +247,6 @@ public class SimpleForm : FormBase
break;
}
}
}
```
@ -351,21 +349,21 @@ Maybe, if i got more ideas, i will add other "controls" in the future.
```
public class ProgressTest : AutoCleanForm
{
public class ProgressTest : AutoCleanForm
{
public ProgressTest()
{
public ProgressTest()
{
this.DeleteMode = eDeleteMode.OnLeavingForm;
}
}
public override async Task Opened()
{
public override async Task Opened()
{
await this.Device.Send("Welcome to ProgressTest");
}
}
public override async Task Action(MessageResult message)
{
public override async Task Action(MessageResult message)
{
var call = message.GetData<CallbackData>();
await message.ConfirmAction();
@ -444,11 +442,11 @@ Maybe, if i got more ideas, i will add other "controls" in the future.
}
}
}
public override async Task Render(MessageResult message)
{
public override async Task Render(MessageResult message)
{
ButtonForm btn = new ButtonForm();
btn.AddButtonRow(new ButtonBase("Standard", new CallbackData("a", "standard").Serialize()), new ButtonBase("Squares", new CallbackData("a", "squares").Serialize()));
@ -459,21 +457,21 @@ Maybe, if i got more ideas, i will add other "controls" in the future.
btn.AddButtonRow(new ButtonBase("Back to start", new CallbackData("a", "start").Serialize()));
await this.Device.Send("Choose your progress bar:", btn);
}
}
public override async Task Closed()
{
public override async Task Closed()
{
foreach (var b in this.Controls)
{
await b.Cleanup();
}
await this.Device.Send("Ciao from ProgressTest");
}
}
}
}
```
@ -485,16 +483,16 @@ To give you an example about the possiblities, i added into the Test project an
```
public class PerForm : AutoCleanForm
{
public String EMail { get; set; }
public class PerForm : AutoCleanForm
{
public String EMail { get; set; }
public String Firstname { get; set; }
public String Firstname { get; set; }
public String Lastname { get; set; }
public String Lastname { get; set; }
public async override Task Load(MessageResult message)
{
public async override Task Load(MessageResult message)
{
if (message.MessageText.Trim() == "")
return;
@ -516,10 +514,10 @@ To give you an example about the possiblities, i added into the Test project an
return;
}
}
}
public async override Task Action(MessageResult message)
{
public async override Task Action(MessageResult message)
{
var call = message.GetData<CallbackData>();
await message.ConfirmAction();
@ -540,10 +538,10 @@ To give you an example about the possiblities, i added into the Test project an
}
}
}
public async override Task Render(MessageResult message)
{
public async override Task Render(MessageResult message)
{
if (this.Firstname == null)
{
await this.Device.Send("Please sent your firstname:");
@ -573,10 +571,10 @@ To give you an example about the possiblities, i added into the Test project an
bf.AddButtonRow(new ButtonBase("Back", new CallbackData("a", "back").Serialize()));
await this.Device.Send("Your details:\r\n" + s, bf);
}
}
}
}
```
@ -607,11 +605,11 @@ For now we have the following:
```
var fto = new TestForm2();
var fto = new TestForm2();
AlertDialog ad = new AlertDialog("This is a message", "Ok", fto);
AlertDialog ad = new AlertDialog("This is a message", "Ok", fto);
await this.NavigateTo(ad);
await this.NavigateTo(ad);
```
@ -626,14 +624,14 @@ For now we have the following:
```
PromptDialog pd = new PromptDialog("Please confirm", new ButtonBase("Ok", "ok"), new ButtonBase("Cancel", "cancel"));
PromptDialog pd = new PromptDialog("Please confirm", new ButtonBase("Ok", "ok"), new ButtonBase("Cancel", "cancel"));
var tf = new TestForm2();
var tf = new TestForm2();
pd.ButtonForms.Add("ok", tf);
pd.ButtonForms.Add("cancel", tf);
pd.ButtonForms.Add("ok", tf);
pd.ButtonForms.Add("cancel", tf);
await this.NavigateTo(pd);
await this.NavigateTo(pd);
```
@ -642,21 +640,21 @@ For now we have the following:
```
PromptDialog pd = new PromptDialog("Please confirm", new ButtonBase("Ok", "ok"), new ButtonBase("Cancel", "cancel"));
PromptDialog pd = new PromptDialog("Please confirm", new ButtonBase("Ok", "ok"), new ButtonBase("Cancel", "cancel"));
//You could mix here for sure.
pd.ButtonForms.Add("ok", null);
pd.ButtonForms.Add("cancel", null);
//You could mix here for sure.
pd.ButtonForms.Add("ok", null);
pd.ButtonForms.Add("cancel", null);
pd.ButtonClicked += async (s, en) =>
{
pd.ButtonClicked += async (s, en) =>
{
var tf = new TestForm2();
//Remember only to navigate from the current running form. (here it is the prompt dialog, cause we have left the above already)
await pd.NavigateTo(tf);
};
};
await this.NavigateTo(pd);
await this.NavigateTo(pd);
```