private void OnIdle(object sender, EventArgs e) {
AssertIsMainThread();
// Even though disposing will disconnect from idle, that could
// happen during idle, so this gets called anyway
if (!IsDisposed && !_taskRunning) {
if (_delay == 0 || TimeUtility.MillisecondsSinceUtc(_idleConnectTime) > _delay) {
_taskRunning = true;
_taskDoneEvent = new ManualResetEvent(false);
DisconnectFromIdle();
Task.Run(new Action(DoTaskInternal));
}
}
}