- removing obsolete Property and methods

- updating test project
This commit is contained in:
FlorianDahn 2019-09-27 23:24:31 +02:00
parent 5c69289198
commit 058539777f
3 changed files with 22 additions and 28 deletions

View File

@ -52,23 +52,37 @@ namespace TelegramBaseTest.Tests
} }
else if (call.Value == "alert") else if (call.Value == "alert")
{ {
var fto = new TestForm2(); AlertDialog ad = new AlertDialog("This is a message", "Ok");
ad.ButtonClicked += async (s, en) =>
{
var fto = new TestForm2();
await this.NavigateTo(fto);
};
AlertDialog ad = new AlertDialog("This is a message", "Ok", fto);
await this.NavigateTo(ad); await this.NavigateTo(ad);
} }
else if (call.Value == "prompt") else if (call.Value == "prompt")
{ {
PromptDialog pd = new PromptDialog("Please confirm"); PromptDialog pd = new PromptDialog("Please confirm");
pd.ButtonClicked += async (s, en) =>
{
if(en.Button.Value == "ok")
{
var tf = new TestForm2();
await pd.NavigateTo(tf);
}
else if(en.Button.Value == "cancel")
{
var tf = new TestForm2();
await pd.NavigateTo(tf);
}
};
pd.AddButton(new ButtonBase("Ok", "ok")); pd.AddButton(new ButtonBase("Ok", "ok"));
pd.AddButton(new ButtonBase("Cancel", "cancel")); pd.AddButton(new ButtonBase("Cancel", "cancel"));
var tf = new TestForm2();
pd.ButtonForms.Add("ok", tf);
pd.ButtonForms.Add("cancel", tf);
await this.NavigateTo(pd); await this.NavigateTo(pd);
} }

View File

@ -22,15 +22,5 @@ namespace TelegramBotBase.Form
} }
[Obsolete]
public AlertDialog(String Message, String ButtonText, FormBase FormToOpen = null) : base(Message)
{
this.Buttons.Add(new ButtonBase(ButtonText, "ok"));
this.ButtonText = ButtonText;
if (FormToOpen != null)
this.ButtonForms.Add("ok", FormToOpen);
}
} }
} }

View File

@ -15,9 +15,6 @@ namespace TelegramBotBase.Form
public List<ButtonBase> Buttons { get; set; } public List<ButtonBase> Buttons { get; set; }
[Obsolete]
public Dictionary<String, FormBase> ButtonForms { get; set; } = new Dictionary<string, FormBase>();
private EventHandlerList __Events { get; set; } = new EventHandlerList(); private EventHandlerList __Events { get; set; } = new EventHandlerList();
private static object __evButtonClicked { get; } = new object(); private static object __evButtonClicked { get; } = new object();
@ -68,13 +65,6 @@ namespace TelegramBotBase.Form
} }
OnButtonClicked(new ButtonClickedEventArgs(button)); OnButtonClicked(new ButtonClickedEventArgs(button));
FormBase fb = ButtonForms.ContainsKey(call.Value) ? ButtonForms[call.Value] : null;
if (fb != null)
{
await this.NavigateTo(fb);
}
} }