public SearchResultPage() { this.InitializeComponent(); this.DataContext = this.ViewModel; this.SearchCompleteCallback += new SearchCompleteDelegate(this.ViewModel.OnSearchComplete); }
public MainPage() { this.InitializeComponent(); this.DataContext = this.ViewModel; this.NavigationCacheMode = NavigationCacheMode.Required; this.Loaded += MainPage_Loaded; this.btnClear.Click += BtnClear_Click; this.btnFeedback.Click += BtnFeedback_Click; this.txtSearch.TextChanged += TxtSearch_TextChanged; this.txtSearch.KeyUp += TxtSearch_KeyUp; this.SearchCompleteCallback += new SearchCompleteDelegate(this.ViewModel.OnSearchComplete); }
public List<Track> SearchForTracks(string searchTerms) { var tracksFound = new List<Track>(); searchCompleteDelegate = SearchComplete; var searchPtr = libspotify.sp_search_create(session.SessionPtr, searchTerms, 0, 10, 0, 0, 0, 0, 0, 0, sp_search_type.SP_SEARCH_STANDARD, Marshal.GetFunctionPointerForDelegate(searchCompleteDelegate), IntPtr.Zero); Wait.For(() => libspotify.sp_search_is_loaded(searchPtr) && libspotify.sp_search_error(searchPtr) == libspotify.sp_error.OK); var tracksFoundCount = libspotify.sp_search_num_tracks(searchPtr); for (var i = 0; i < tracksFoundCount; i++) { var track = new Track(libspotify.sp_search_track(searchPtr, i), session); tracksFound.Add(track); } return tracksFound; }