Ejemplo n.º 1
0
 private void ScheduleFullClientPing()
 {
     RemoveFullClientPingIfPossible();
     _fullClientHeartbeat = new WakeLockBalancer.GracefulWakeLock(new WakeLockBalancer.ActionObject(() =>
     {
         if (!IsFullClientConnected)
         {
             RemoveFullClientPingIfPossible();
         }
         else
         {
             Ping(_fullClient);
             try
             {
                 SendPresence(_fullClient);
             }
             catch (Exception ex)
             {
                 Utils.DebugPrint("Failed to send presence in full client ping: " + ex);
                 // fall-through
             }
         }
     }, WakeLockBalancer.ActionObject.ExecuteType.TaskWithWakeLock), 240, 60, true);
     Platform.ScheduleAction(_fullClientHeartbeat);
 }
Ejemplo n.º 2
0
 private void RemoveFullClientPingIfPossible()
 {
     if (_fullClientHeartbeat != null)
     {
         Platform.RemoveAction(_fullClientHeartbeat);
         _fullClientHeartbeat = null;
     }
 }
Ejemplo n.º 3
0
 private void ScheduleFullClientPing()
 {
     RemoveFullClientPingIfPossible();
     _fullClientHeartbeat = new WakeLockBalancer.GracefulWakeLock(new WakeLockBalancer.ActionObject(() =>
     {
         if (!IsFullClientConnected)
         {
             RemoveFullClientPingIfPossible();
         }
         else
         {
             Ping(_fullClient);
             try
             {
                 SendPresence(_fullClient);
             }
             catch (Exception ex)
             {
                 Utils.DebugPrint("Failed to send presence in full client ping: " + ex);
                 // fall-through
             }
         }
     }, WakeLockBalancer.ActionObject.ExecuteType.TaskWithWakeLock), 240, 60, true);
     Platform.ScheduleAction(_fullClientHeartbeat);
 }
Ejemplo n.º 4
0
 private void RemoveFullClientPingIfPossible()
 {
     if (_fullClientHeartbeat != null)
     {
         Platform.RemoveAction(_fullClientHeartbeat);
         _fullClientHeartbeat = null;
     }
 }
Ejemplo n.º 5
0
 private void RemoveLongPollPingIfPossible()
 {
     if (_longPollHeartbeart != null)
     {
         Platform.RemoveAction(_longPollHeartbeart);
         _longPollHeartbeart = null;
     }
 }
Ejemplo n.º 6
0
 private void ScheduleLongPollPing()
 {
     RemoveLongPollPingIfPossible();
     _longPollHeartbeart = new WakeLockBalancer.GracefulWakeLock(new WakeLockBalancer.ActionObject(() =>
     {
         if (_longPollClient == null || !_longPollClient.IsConnected)
         {
             RemoveLongPollPingIfPossible();
             RestartTelegram(null);
         }
         else
         {
             Ping(_longPollClient, RestartTelegram);
         }
     }, WakeLockBalancer.ActionObject.ExecuteType.TaskWithWakeLock), 240, 60, true);
     Platform.ScheduleAction(_longPollHeartbeart);
 }
Ejemplo n.º 7
0
 private void ScheduleFullClientPing()
 {
     RemoveFullClientPingIfPossible();
     _fullClientHeartbeat = new WakeLockBalancer.GracefulWakeLock(new WakeLockBalancer.ActionObject(() =>
     {
         if (!IsFullClientConnected)
         {
             RemoveFullClientPingIfPossible();   
         }
         else
         {
             Ping(_fullClient);
         }
     }, WakeLockBalancer.ActionObject.ExecuteType.TaskWithWakeLock), 240, 60, true);
     Platform.ScheduleAction(_fullClientHeartbeat);
 }