Esempio n. 1
0
        private async void SetLyric()
        {
            if (this.ViewModel == null)
            {
                return;
            }

            var    songId    = BackgroundStreamingService.GetCurrentSong();
            var    lyricTemp = await((PlayerViewModel)this.ViewModel).GetLyric(songId);
            var    parts     = lyricTemp.Split('\n');
            string result    = string.Empty;

            this.Lyrics = new Dictionary <double, string>();
            foreach (var part in parts)
            {
                var tempPart = part.Split(']');
                if (tempPart.Length > 1)
                {
                    var      clean = tempPart[0].Replace("[", "");
                    TimeSpan timeSpan;
                    if (TimeSpan.TryParseExact(clean, @"mm\:ss\.fff", CultureInfo.CurrentCulture, out timeSpan))
                    {
                        this.Lyrics.Add(timeSpan.TotalMilliseconds, tempPart[1].Replace("[", ""));
                    }
                    result += tempPart[1].Replace("[", "") + "\n";
                }
                else
                {
                    result += tempPart[0].Replace("[", "") + "\n";
                }
            }
            this.lyricContainer.Text = result;
        }
Esempio n. 2
0
        private void Repeat_CheckedChange(object sender, CompoundButton.CheckedChangeEventArgs e)
        {
            var a = BackgroundStreamingService.GetCurrentSong();

            BackgroundStreamingService.IsRepeat = e.IsChecked;
        }