コード例 #1
0
 private void ApplyEnabledState(bool enabled)
 {
     lock (_serviceLock)
     {
         if (enabled && ChannelGroup != null && SessionTracker == null)
         {
             SessionTracker = CreateSessionTracker(ChannelGroup, Channel, ApplicationSettings);
             if (!ApplicationLifecycleHelper.Instance.IsSuspended)
             {
                 SessionTracker.Resume();
             }
             SubscribeToApplicationLifecycleEvents();
         }
         else if (!enabled)
         {
             UnsubscribeFromApplicationLifecycleEvents();
             SessionTracker?.ClearSessions();
             SessionTracker = null;
         }
     }
 }
コード例 #2
0
 private void ApplyEnabledState(bool enabled)
 {
     lock (_serviceLock)
     {
         if (enabled && ChannelGroup != null && SessionTracker == null)
         {
             SessionTracker = CreateSessionTracker(ChannelGroup, Channel);
             ApplicationLifecycleHelper.Enabled = true;
             if (_hasStarted)
             {
                 SessionTracker.Resume();
             }
         }
         else if (!enabled)
         {
             ApplicationLifecycleHelper.Enabled = false;
             SessionTracker?.ClearSessions();
             SessionTracker = null;
         }
     }
 }