private void OnTimerTick(Object sender, EventArgs e) { LyricsTimeLineSlider.SetTimeLinePosition(Mp3Player); LyricsInfo.SetTimeLinePosition(Mp3Player); LyricsDisplayUC.DoHightLightWords((Int32)Mp3Player.Position.TotalSeconds); if (Mp3Player.CurrentState.ToString() == "Paused") { ResetPlayIcon(); } }
public MainPage() { InitializeComponent(); LyricsDisplayUC.Items = LyricsReader1(); LyricsDisplayUC.SetDataContext(); LyricsInfo.SetDataContext(); appbarPreviousButton = ApplicationBar.Buttons[0] as ApplicationBarIconButton; appbarPlayAndPauseButton = ApplicationBar.Buttons[1] as ApplicationBarIconButton; appbarStopButton = ApplicationBar.Buttons[2] as ApplicationBarIconButton; appbarNextButton = ApplicationBar.Buttons[3] as ApplicationBarIconButton; DispatcherTimer Timer = new DispatcherTimer(); Timer.Interval = TimeSpan.FromSeconds(0.5); Timer.Tick += OnTimerTick; Timer.Start(); }