コード例 #1
0
        public async Task <bool> LrcAutoSearch()
        {
            LrcMissing        = false;
            LrcSearchBusy     = true;
            _presenter.Lyrics = null;
            var _ttitle  = _title;
            var _tartist = _artist;

            LrcCandidates = new ObservableCollection <ExternalLrcInfo>();
            ParsedLrc lrc = null;

            try
            {
                lrc = await LyricsAgent.FetchLyricsAsync(
                    _title, _artist, _candidates,
                    LyricsAgent.BuildLyricsFilename(_title, _artist));
            }
            catch
            {
            }
            if (_ttitle == _title && _tartist == _artist)
            {
                _presenter.Lyrics = lrc;
                LrcSearchBusy     = false;
                LrcMissing        = lrc == null || lrc.Sentences.Count == 0;
                return(true);
            }
            return(false);
        }
コード例 #2
0
        private async void Search()
        {
            try
            {
                if (_isBusy)
                {
                    return;
                }
                IsBusy = true;
                var list = new List <ExternalLrcInfo>();
                await LyricsAgent.FetchLyricsAsync(Title, Artist, list, _cacheName, true);

                LoadData(list);
            }
            catch (Exception ex)
            {
                ResultText = string.Format(CommonSharedStrings.SearchError, ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #3
0
        public async Task <ParsedLrc> DownloadAsync()
        {
            var candidate = LyricCandidates[SelectedIndex];

            return(await LyricsAgent.FetchLyricsAsync(candidate, LyricsAgent.BuildLyricsFilename(_originalTitle, _originalArtist)));
        }