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 Task LoginAsync(LoginParameters loginParams, object stateObject) { return(Task.Factory.FromAsync <LoginParameters>(BeginLogin, EndLogin, loginParams, stateObject)); }