Exemplo n.º 1
0
        public SearchResultPage()
        {
            this.InitializeComponent();
            this.DataContext = this.ViewModel;

            this.SearchCompleteCallback += new SearchCompleteDelegate(this.ViewModel.OnSearchComplete);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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;
        }