using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using BSE.Platten.Audio; using BSE.Platten.BO; using BSE.Platten.Tunes.Properties; using System.Globalization; namespace BSE.Platten.Tunes { public partial class AlbumProperties : UserControl { #region Events public event EventHandler<AlbumSelectEventArgs> AlbumSelected; #endregion #region FieldsPrivate private BSE.Platten.BO.CAlbum m_currentAlbum; private Image m_imgNoCover; #endregion #region Properties public CPlayerManager PlayerManager { get { return this.m_albumPropertiesListView.PlayerManager; } set { this.m_albumPropertiesListView.PlayerManager = value; } } public BSE.Configuration.Configuration Settings { get { return this.m_albumPropertiesListView.Settings; } set { this.m_albumPropertiesListView.Settings = value; } } #endregion #region MethodsPublic public AlbumProperties() { InitializeComponent(); this.m_imgNoCover = Resources.keinBild; } public void SetCurrentAlbum(BSE.Platten.BO.CAlbum currentAlbum) { this.m_currentAlbum = currentAlbum; this.m_picCover.Image = null; this.m_pnlAlbumProperties.Text = string.Empty; this.m_lblInterpret.Visible = false; this.m_lblInterpret.Text = string.Empty; this.m_lblAlbum.Visible = false; this.m_lblAlbum.Text = String.Empty; this.m_lblGenre.Visible = false; this.m_lblGenre.Text = String.Empty; this.m_lblYear.Visible = false; this.m_lblYear.Text = String.Empty; this.m_lblDuration.Visible = false; this.m_lblDuration.Text = string.Empty; if (this.m_currentAlbum != null) { string strInterpret = this.m_currentAlbum.Interpret; if (String.IsNullOrEmpty(strInterpret) == false) { this.m_lblInterpret.Visible = true; this.m_lblInterpret.Text = strInterpret; } string strAlbum = this.m_currentAlbum.Title; if (String.IsNullOrEmpty(strAlbum) == false) { this.m_lblAlbum.Visible = true; this.m_lblAlbum.Text = strAlbum; } string strGenre = this.m_currentAlbum.Genre; if (String.IsNullOrEmpty(strGenre) == false) { this.m_lblGenre.Visible = true; this.m_lblGenre.Text = strGenre; } int iYear = this.m_currentAlbum.Year; if (iYear != 0) { this.m_lblYear.Visible = true; this.m_lblYear.Text = iYear.ToString(CultureInfo.CurrentUICulture); } if (this.m_currentAlbum.Tracks != null) { TimeSpan totalDuration = new TimeSpan(); foreach (CTrack track in this.m_currentAlbum.Tracks) { if (String.IsNullOrEmpty(track.FileName) == false) { totalDuration = totalDuration.Add(track.Duration); } } this.m_lblDuration.Visible = true; this.m_lblDuration.Text = totalDuration.Duration().ToString(); } this.m_pnlAlbumProperties.Text = string.Format(CultureInfo.CurrentUICulture, Resources.IDS_AlbumPropertiesPanelText, strInterpret, strAlbum); if (this.m_currentAlbum.Cover != null) { float fPictRatio = this.m_picCover.Height / (float)this.m_currentAlbum.Cover.Height; this.m_picCover.Width = (int)(this.m_currentAlbum.Cover.Width * fPictRatio); this.m_picCover.Image = this.m_currentAlbum.Cover; } else { this.m_picCover.Image = this.m_imgNoCover; } this.m_albumPropertiesListView.SetCurrentAlbum(this.m_currentAlbum); OnAlbumSelected(new AlbumSelectEventArgs(this.m_currentAlbum.AlbumId)); } else { this.m_lblInterpret.Visible = false; this.m_lblAlbum.Visible = false; this.m_lblGenre.Visible = false; this.m_lblYear.Visible = false; } } #endregion #region MethodsProtected protected override void OnResize(EventArgs e) { base.OnResize(e); //Workaround: Das Tabcontrol wird beim //ausblenden des Clipboards nicht neu gezeichnet this.m_tabAlbumProperties.Invalidate(); } protected void OnAlbumSelected(AlbumSelectEventArgs e) { if (AlbumSelected != null) { AlbumSelected(this, e); } } #endregion } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)