Adds another callback recurrent timed tasks.

This commit is contained in:
Paulo Rogerio Panhoto 2018-03-01 19:50:29 -03:00
parent 8b392f5159
commit 4c112086aa

View file

@ -37,7 +37,8 @@ namespace TLSharp.Core
public delegate void ClientEvent(TelegramClient source);
public event UpdatesEvent Updates;
public event ClientEvent IdleLoop;
public event ClientEvent ScheduledTasks;
public event ClientEvent IdleTasks;
public Session Session { get { return _session; } }
@ -148,12 +149,13 @@ namespace TLSharp.Core
await SendPingAsync();
lastPing = now;
}
if (IdleLoop != null)
if (ScheduledTasks != null)
{
logger.Trace("Running idle tasks");
IdleLoop.Invoke(this);
IdleLoop = null;
ScheduledTasks.Invoke(this);
ScheduledTasks = null;
}
IdleTasks?.Invoke(this);
}
}
}