예제 #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);
 }
예제 #2
0
 private void RemoveFullClientPingIfPossible()
 {
     if (_fullClientHeartbeat != null)
     {
         Platform.RemoveAction(_fullClientHeartbeat);
         _fullClientHeartbeat = null;
     }
 }
예제 #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);
 }
예제 #4
0
 private void RemoveFullClientPingIfPossible()
 {
     if (_fullClientHeartbeat != null)
     {
         Platform.RemoveAction(_fullClientHeartbeat);
         _fullClientHeartbeat = null;
     }
 }
예제 #5
0
 private void RemoveLongPollPingIfPossible()
 {
     if (_longPollHeartbeart != null)
     {
         Platform.RemoveAction(_longPollHeartbeart);
         _longPollHeartbeart = null;
     }
 }
예제 #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);
 }
예제 #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);
 }