public LyricsWindow() { InitializeComponent(); PrestoSDK.PrestoService.Player.StreamChanged += Player_StreamChanged; this.Left = SystemParameters.WorkArea.Width - this.Width; this.Top = SystemParameters.WorkArea.Height - this.Height; lyricsManager = new LyricsManager(); var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(300) }; timer.Tick += Timer_Tick; timer.Start(); }
// 재생중인 음악이 바뀌면 private void Player_StreamChanged(object sender, Common.StreamChangedEventArgs e) { // 큰 플레이어가 실행중이고, 숨겨진 상태라면 if (IsThisWindowShow == true) { this.Show(); } lyricsManager = null; lyricsManager = new LyricsManager(); lyricsManager.LyricsListIndex = 0; // 현재 바뀐 음악에 대한 가사 처리 lyricsManager.StreamChanged(); // 재바인딩 lyricsList.ItemsSource = lyricsManager.GetLyricsData(); isAutoLyricsIndexChange = true; lyricsList.SelectedIndex = 0; lyricsList.ScrollIntoView(lyricsList.Items[0]); }