/// <summary> /// Handles the Tick event of the Timer control. /// </summary> private void Timer_Tick() { var form = FindForm(); if (form != null && form.WindowState == FormWindowState.Minimized) { return; } if (_timerTick) { return; } _timerTick = true; var position = BassPlayer.GetTrackPosition(); if (slider.Maximum != position.Length) { slider.Maximum = (int)position.Length; } if (slider.Value != position.Positition) { slider.Value = (int)position.Positition; } if (lblTimeElapsed.Text != position.ElapsedFormatted) { lblTimeElapsed.Text = position.ElapsedFormatted; } if (lblTimeRemaining.Text != position.RemainingFormatted) { lblTimeRemaining.Text = position.RemainingFormatted; } btnPause.Visible = BassPlayer.PlayState == PlayState.Playing; btnPlay.Visible = BassPlayer.PlayState != PlayState.Playing; if (ToolStripLabel != null) { if (!Visible && BassPlayer.PlayState == PlayState.Playing) { var text = lblCurrentTrackDescription.Text + " - " + position.ElapsedFormatted + " elapsed - " + position.RemainingFormatted + " remaining"; ToolStripLabel.Text = text; } else { ToolStripLabel.Text = ""; } } ShowVisuals(); _timerTick = false; }