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; } } }
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; } } }