/// <summary> /// Sets the session data. /// </summary> /// <param name="newSession">The new <see cref="APISession"/> instance.</param> /// <exception cref="ArgumentNullException">Thrown when a <code>newSession</code> is <code>null</code>.</exception> public void SetSessionData(APISession newSession) { if (Session != null && !Session.IsEndless) { Session.AccessTokenExpired -= AccessTokenExpired; } if (newSession != null && !newSession.IsEndless) { newSession.AccessTokenExpired += AccessTokenExpired; } Session = newSession; }
/// <summary> /// Sets the session data. /// </summary> /// <param name="newSession">The new <see cref="APISession"/> instance.</param> /// <exception cref="ArgumentNullException">Thrown when a <code>newSession</code> is <code>null</code>.</exception> internal void SetSessionData(APISession newSession) { if (newSession == null) { throw new ArgumentNullException(nameof(newSession), "Value cannot be null."); } if (Session != null) { Session.AccessTokenExpired -= AccessTokenExpired; } newSession.AccessTokenExpired += AccessTokenExpired; Session = newSession; }