//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ #region --Set-, Get- Methods-- private async Task SetStateAsync(PushManagerState state) { await STATE_SEMA.WaitAsync(); if (state != this.state) { PushManagerState oldState = this.state; this.state = state; STATE_SEMA.Release(); StateChanged?.Invoke(this, new PushManagerStateChangedEventArgs(state, oldState)); } else { STATE_SEMA.Release(); } }
/// <summary> /// Should be called once the PushManager changes its state to DEACTIVATED. /// </summary> public void OnPushManagerDeactivated() { pushManagerState = PushManagerState.DEACTIVATED; TryUpdateClientPush(); }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- public PushManagerStateChangedEventArgs(PushManagerState newState, PushManagerState oldState) { NEW_STATE = newState; OLD_STATE = oldState; }
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ #region --Set-, Get- Methods-- #endregion //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ #region --Misc Methods (Public)-- /// <summary> /// Should be called once the PushManager changes its state to INITIALIZED. /// </summary> public void OnPushManagerInitialized() { pushManagerState = PushManagerState.INITIALIZED; TryUpdateClientPush(); }