void progressTimer_Tick(object sender, EventArgs e) { try { if (Bass.BASS_ChannelIsActive(player.Channel) != BASSActive.BASS_ACTIVE_STOPPED) { this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { int cpu = Convert.ToInt32(Bass.BASS_GetCPU() * 100); menuBar.CPU.Text = "CPU Usage: " + cpu.ToString() + "%"; player.Update(); double PercentOfTrack = player.Song.CurrentPositionInSeconds / player.Song.TotalLengthInSeconds; double trackBarLength = nowPlaying.trackBarBg.ActualWidth; nowPlaying.playedAmount.Width = PercentOfTrack * trackBarLength; nowPlaying.TotalTime.Text = Lala.API.Functions.SecondsToTime(player.Song.TotalLengthInSeconds, false); nowPlaying.CurrentTime.Text = Lala.API.Functions.SecondsToTime(player.Song.CurrentPositionInSeconds, false); double percentOfDownload = player.Song.CurrentPosition / player.Song.TotalLength; nowPlaying.loadedAmount.Width = percentOfDownload * trackBarLength; })); } else if (Lala.API.Instance.CurrentUser.Queue.Count > 0) { PlayNextInQueue(); } else { progressTimer.Stop(); } } catch (DllNotFoundException) { Functions.DownloadDlls(); } }