Click here to Skip to main content
15,860,972 members
Articles / Desktop Programming / Windows Forms

BSEtunes

Rate me:
Please Sign up or sign in to vote.
4.67/5 (11 votes)
24 Apr 2010CPOL4 min read 64.2K   4.3K   58  
BSEtunes is a MySQL based, full manageable, networkable single or multiuser jukebox application
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.Common;
using System.Globalization;
using BSE.Platten.Audio.Properties;

namespace BSE.Platten.Audio
{
    public partial class CWinampConfigurationControl : BaseConfigurationControl
    {
        #region MethodsPublic

        public CWinampConfigurationControl()
        {
            InitializeComponent();
            this.Text = Resources.IDS_WinampPropertiesTitle;
            this.m_lblPath.Text = Resources.IDS_WinampPropertiesPathTo;
        }

        public override void LoadConfigurationValues(BSE.Configuration.Configuration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration",
                    string.Format(System.Globalization.CultureInfo.InvariantCulture,
                    Properties.Resources.IDS_ArgumentNullException,
                    "configuration"));
            }
            
            WinampConfigurationData winampConfigurationObject = 
                GetConfiguration(configuration) as WinampConfigurationData;
            
            if (winampConfigurationObject != null)
            {
                this.m_txtPath.Text = winampConfigurationObject.FileName;
            }
        }

        public override void SaveConfigurationValues(BSE.Configuration.Configuration configuration)
        {
            WinampConfigurationData winampConfigurationObject = new WinampConfigurationData();
            winampConfigurationObject.FileName = this.m_txtPath.Text;
            configuration.SetValue(
                BaseConfigurationControl.OptionsConfiguration,
                typeof(WinampConfigurationData).Name,
                winampConfigurationObject);
        }

        public static IConfigurationData GetConfiguration(BSE.Configuration.Configuration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration",
                    string.Format(System.Globalization.CultureInfo.InvariantCulture,
                    Properties.Resources.IDS_ArgumentNullException,
                    "configuration"));
            }
            return configuration.GetValue(
               BSE.Platten.Common.BaseConfigurationControl.OptionsConfiguration,
               typeof(WinampConfigurationData).Name,
               new WinampConfigurationData()) as WinampConfigurationData;
        }

        #endregion

        #region MethodsPrivate

        private void m_btnConfig_Click(object sender, EventArgs e)
        {
            if (this.m_ofdlgFileSearch.ShowDialog() == DialogResult.OK)
            {
                if (String.IsNullOrEmpty(this.m_ofdlgFileSearch.FileName) == false)
                {
                    string strPath = string.Format(
                        CultureInfo.InvariantCulture,
                        this.m_ofdlgFileSearch.FileName.ToLower(CultureInfo.InvariantCulture));
                    if (strPath.EndsWith("winamp.exe", StringComparison.OrdinalIgnoreCase) == true)
                    {
                        this.m_txtPath.Text = this.m_ofdlgFileSearch.FileName;
                        OnConfigChanging(new EventArgs());
                    }
                }
            }
        }

        #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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions