public IAsyncResult BeginLogin(LoginParameters loginParams, AsyncCallback userCallback, object stateObject) { AsyncLoginResult result = new AsyncLoginResult(userCallback, stateObject); this.LoggedIn += result.HandleLoggedIn; ThrowHelper.ThrowIfError(LibSpotify.sp_session_login_r(Handle, loginParams.UserName, loginParams.Password, loginParams.RememberMe, IntPtr.Zero)); return(result); }
public void EndLogin(IAsyncResult result) { AsyncLoginResult loginResult = ThrowHelper.DownCast <AsyncLoginResult>(result, "result"); loginResult.WaitAndCheckPendingException(); }