FIX: new message loop will now correctly manage events and form switches
This commit is contained in:
parent
31e0683699
commit
72d94df907
@ -372,32 +372,33 @@ namespace TelegramBotBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Action Event
|
//Action Event
|
||||||
if (!ds.FormSwitched)
|
if (!ds.FormSwitched && e.IsAction)
|
||||||
{
|
{
|
||||||
if (e.IsAction)
|
//Send Action event to controls
|
||||||
|
await activeForm.ActionControls(e);
|
||||||
|
|
||||||
|
//Send Action event to form itself
|
||||||
|
await activeForm.Action(e);
|
||||||
|
|
||||||
|
if (!e.Handled)
|
||||||
{
|
{
|
||||||
//Send Action event to controls
|
var uhc = new UnhandledCallEventArgs(e.Message.Text, e.RawData, ds.DeviceId, e.MessageId, e.Message, ds);
|
||||||
await activeForm.ActionControls(e);
|
OnUnhandledCall(uhc);
|
||||||
|
|
||||||
//Send Action event to form itself
|
if (uhc.Handled)
|
||||||
await activeForm.Action(e);
|
|
||||||
|
|
||||||
if (!e.Handled)
|
|
||||||
{
|
{
|
||||||
var uhc = new UnhandledCallEventArgs(e.Message.Text, e.RawData, ds.DeviceId, e.MessageId, e.Message, ds);
|
e.Handled = true;
|
||||||
OnUnhandledCall(uhc);
|
if (!ds.FormSwitched)
|
||||||
|
|
||||||
if (uhc.Handled)
|
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
break;
|
||||||
if (!ds.FormSwitched)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ds.FormSwitched)
|
||||||
|
{
|
||||||
//Render Event
|
//Render Event
|
||||||
await activeForm.RenderControls(e);
|
await activeForm.RenderControls(e);
|
||||||
|
|
||||||
@ -433,10 +434,10 @@ namespace TelegramBotBase
|
|||||||
{
|
{
|
||||||
DeviceSession ds = this.Sessions.GetSession(DeviceId);
|
DeviceSession ds = this.Sessions.GetSession(DeviceId);
|
||||||
e.Device = ds;
|
e.Device = ds;
|
||||||
|
|
||||||
await Client_Loop(this, e);
|
await Client_Loop(this, e);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
DeviceSession ds = this.Sessions.GetSession(DeviceId);
|
DeviceSession ds = this.Sessions.GetSession(DeviceId);
|
||||||
OnException(new SystemExceptionEventArgs(e.Message.Text, DeviceId, ds, ex));
|
OnException(new SystemExceptionEventArgs(e.Message.Text, DeviceId, ds, ex));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user