private void SearchCompleteCallback(IntPtr searchPtr, IntPtr userDataPtr) { Search search = new Search(searchPtr); int id = userDataPtr.ToInt32(); object state = states.ContainsKey(id) ? states[id] : null; if (id <= short.MaxValue) { states.Remove(id); EnqueueEventWorkItem(new EventWorkItem(OnSearchComplete, new object[] { this, new SearchEventArgs(search, state) })); } else { if (state != null && state is ManualResetEvent) { states[id] = search; (state as ManualResetEvent).Set(); } } }
internal SearchEventArgs(Search result, object state) { this.result = result; this.state = state; }
public static Link FromSearch(Search search) { ThrowHelper.ThrowIfNull(search, "search"); return(new Link(LibSpotify.sp_link_create_from_search_r(search.Handle))); }