private void SetPositionTitle(VkSong song, int pos) { using (Graphics graphics = this.CreateGraphics()) { this.SetTimeTitle(pos, song.Duration); string text = "Превью | " + song.ToString(); int num = (int) Math.Ceiling((double) graphics.MeasureString(text, this.lPreviewHeader.Font).Width); if (num + this.lPreviewHeader.Left >= this.lPreviewTime.Left - 10) { string str = song.ToString(); for (; num + this.lPreviewHeader.Left >= this.lPreviewTime.Left - 10; num = (int) Math.Ceiling((double) graphics.MeasureString(text, this.lPreviewHeader.Font).Width)) { str = str.Remove(str.Length - 1); text = "Превью | " + str + "..."; } } this.lPreviewHeader.Text = text; } }
private void StartSong(VkSong song) { this.lastSelectedProgress = -1; this.tbPreviewProgress.Enabled = false; VkAudioClass.Instance.InvokeLoadUrl(song.URL); this.btnPlayPause.BackgroundImage = (Image) Resources.pause; this.previewState = PlayerState.Playing; this.previewTimer.Start(); }
private void InitPreview(VkSong song, bool startPlaying) { if (this.previewState == PlayerState.Paused || this.previewState == PlayerState.Playing) this.StopPreviewPlayback(false); this.gbPreview.Tag = (object) song; this.tbPreviewProgress.Minimum = 0; this.tbPreviewProgress.Maximum = song.Duration; this.tbPreviewProgress.Value = 0; this.tbPreviewProgress.Enabled = false; this.gbPreview.Enabled = this.lPreviewHeader.Enabled = this.lPreviewTime.Enabled = true; if (startPlaying) this.StartSong(song); this.SetPositionTitle(song, 0); }