Creating DeviceSession and other stuff slight earlier in the LoadSessionStates methods

This commit is contained in:
FlorianDahn 2021-07-25 01:53:55 +02:00
parent e88114049e
commit be2660239a

View File

@ -208,6 +208,13 @@ namespace TelegramBotBase
}
}
form.Client = Client;
var device = new DeviceSession(s.DeviceId, form);
device.ChatTitle = s.ChatTitle;
this.SessionList.Add(s.DeviceId, device);
//Is Subclass of IStateForm
var iform = form as IStateForm;
if (iform != null)
@ -217,14 +224,6 @@ namespace TelegramBotBase
iform.LoadState(ls);
}
form.Client = Client;
var device = new DeviceSession(s.DeviceId, form);
device.ChatTitle = s.ChatTitle;
this.SessionList.Add(s.DeviceId, device);
try
{
await form.OnInit(new InitEventArgs());