Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version
Go to top

BSEtunes

, 24 Apr 2010
BSEtunes is a MySQL based, full manageable, networkable single or multiuser jukebox application
BSE.Platten.zip
BSE.Platten
BSE.Platten.vssscc
mssccprj.scc
vssver2.scc
BSE.CoverFlow.WPFLib
BSE.CoverFlow.WPFLib.csproj.user
BSE.CoverFlow.WPFLib.csproj.vspscc
mssccprj.scc
vssver2.scc
Images
close.png
exit.png
next.png
next_disabled.png
Note.jpg
pause.png
PlayButton.png
previous.png
previous_disabled.png
stop.png
vssver2.scc
Properties
Settings.settings
vssver2.scc
Resources
vssver2.scc
BSE.Platten.Admin
BSE.Platten.Admin.csproj.vspscc
mssccprj.scc
vssver2.scc
Properties
Settings.settings
vssver2.scc
Resources
Album16.gif
BSEadmin.ico
cdimport.png
cdrip.png
cd_hoeren.png
clearsearch.png
DataContainer_MoveFirsHS.png
DataContainer_MoveLastHS.png
DataContainer_MoveNextHS.png
DataContainer_MovePreviousHS.png
DataContainer_NewRecordHS.png
diskinfo.png
DRIVEDSC.png
DRIVENET.png
Edit_UndoHS.png
exportimage.png
findfile.png
FindHS.png
freedb.png
Genre16.png
Image.png
InsertPictureHS.png
Interpret16.png
OptionsHS.png
PieChart3DHS.png
PieChartHS.png
ProtectFormHS.png
RefreshDocViewHS.png
saveHS.png
search.png
song.png
system.png
tagger.png
tools_16.png
vssver2.scc
BSE.Platten.Admin.WinApp
BSE.Platten.Admin.WinApp.csproj.user
BSE.Platten.Admin.WinApp.csproj.vspscc
mssccprj.scc
vssver2.scc
Properties
Settings.settings
vssver2.scc
Resources
BSEadmin.ico
vssver2.scc
BSE.Platten.Audio
bse.ico
BSE.Platten.Audio.csproj.vspscc
mssccprj.scc
vssver2.scc
Options
vssver2.scc
Player
vssver2.scc
Properties
vssver2.scc
Resources
FillDownHS.png
FillLeftHS.png
Folder256.png
FolderFind.png
FolderOpen256.png
GoLtrHS.png
MoveNext.png
MovePrevious.png
OptionsHS.png
PauseHS.png
PlayHS.png
Slider.gif
Start.png
StopHS.png
vssver2.scc
WinControls
vssver2.scc
WMFSDK
vssver2.scc
BSE.Platten.BO
BSE.Platten.BO.csproj.vspscc
mssccprj.scc
vssver2.scc
Properties
vssver2.scc
BSE.Platten.Common
BSE.Platten.Common.csproj.vspscc
mssccprj.scc
vssver2.scc
Properties
vssver2.scc
Resources
BSEsplash.png
DRIVEDSC.png
DRIVENET.png
Network.png
splash.png
vssver2.scc
BSE.Platten.Covers
BSE.Platten.Covers.csproj.vspscc
mssccprj.scc
vssver2.scc
Properties
Settings.settings
vssver2.scc
BSE.Platten.FreeDb
BSE.Platten.FreeDb.csproj.vspscc
mssccprj.scc
vssver2.scc
Properties
vssver2.scc
Resources
OpenCD.png
vssver2.scc
BSE.Platten.Ripper
BSE.Platten.Ripper.csproj.vspscc
mssccprj.scc
vssver2.scc
Properties
vssver2.scc
Resources
OpenCD.png
OptionsHS.png
vssver2.scc
BSE.Platten.Statistik
BSE.Platten.Statistik.csproj.vspscc
mssccprj.scc
vssver2.scc
Properties
vssver2.scc
BSE.Platten.Tunes
BSE.Platten.Tunes.csproj.user
BSE.Platten.Tunes.csproj.vspscc
mssccprj.scc
vssver2.scc
Filters
vssver2.scc
Properties
Settings.settings
vssver2.scc
Resources
About.png
Album16.gif
AudioCD.png
AudioFile.png
AutoList.png
broadcast.png
BSE.png
BSEAbout.png
BSEsplash.png
BSEtunes.ico
BSE_16.png
cd_hoeren.png
coverflow.png
DataContainer_MoveNextHS.png
delete.gif
diskinfo.png
Filter2HS.png
FindHS.png
Folder256.png
FolderOpen256.png
Genre16.gif
Interpret16.gif
keinBild.gif
NewPlaylist16.gif
OptionsHS.png
PauseHS.png
RefreshDocViewHS.png
Removabledrive.png
saveHS.png
search.png
shuffle.png
Shuffle_icon.png
song.png
splash1.png
StopHS.png
TaskHS.png
TrackInfo.gif
vssver2.scc
wiedergabe16.gif
BSEadminSetup
BSEadminSetup.vdproj
BSEadminSetup.vdproj.vspscc
mssccprj.scc
vssver2.scc
Debug
Release
BSEtunesSetup
BSEtunesSetup.vdproj
BSEtunesSetup.vdproj.vspscc
mssccprj.scc
vssver2.scc
Debug
Release
dll
BSE.CDDrives.DLL
BSE.Charts.DLL
BSE.Configuration.DLL
BSE.RemovableDrives.DLL
BSE.Shell.DLL
BSE.Windows.Forms.DLL
Lame
lame_enc.dll
vssver2.scc
lame-3.97
BSE.Platten_en.zip
BSE.CoverFlow.WPFLib.csproj.user
close.png
exit.png
next.png
next_disabled.png
Note.jpg
pause.png
PlayButton.png
previous.png
previous_disabled.png
stop.png
vssver2.scc
Settings.settings
vssver2.scc
vssver2.scc
BSE.Platten.Admin.csproj.user
Settings.settings
vssver2.scc
Album16.gif
BSEadmin.ico
cdimport.png
cdrip.png
cd_hoeren.png
clearsearch.png
DataContainer_MoveFirsHS.png
DataContainer_MoveLastHS.png
DataContainer_MoveNextHS.png
DataContainer_MovePreviousHS.png
DataContainer_NewRecordHS.png
diskinfo.png
DRIVEDSC.png
DRIVENET.png
Edit_UndoHS.png
exportimage.png
findfile.png
FindHS.png
freedb.png
Genre16.png
Image.png
InsertPictureHS.png
Interpret16.png
OptionsHS.png
PieChart3DHS.png
PieChartHS.png
ProtectFormHS.png
RefreshDocViewHS.png
saveHS.png
search.png
song.png
system.png
tagger.png
tools_16.png
vssver2.scc
BSE.Platten.Admin.WinApp.csproj.user
Settings.settings
vssver2.scc
BSEadmin.ico
vssver2.scc
bse.ico
BSE.Platten.Audio.csproj.user
vssver2.scc
vssver2.scc
vssver2.scc
FillDownHS.png
FillLeftHS.png
Folder256.png
FolderFind.png
FolderOpen256.png
GoLtrHS.png
MoveNext.png
MovePrevious.png
OptionsHS.png
PauseHS.png
PlayHS.png
Slider.gif
Start.png
StopHS.png
vssver2.scc
vssver2.scc
vssver2.scc
BSE.Platten.BO.csproj.user
vssver2.scc
BSE.Platten.Common.csproj.user
vssver2.scc
BSEsplash.png
DRIVEDSC.png
DRIVENET.png
Network.png
splash.png
vssver2.scc
BSE.Platten.Covers.csproj.user
Settings.settings
vssver2.scc
BSE.Platten.FreeDb.csproj.user
vssver2.scc
OpenCD.png
vssver2.scc
AudioWriter
vssver2.scc
BSE.Platten.Ripper.csproj.user
Lame
vssver2.scc
vssver2.scc
OpenCD.png
OptionsHS.png
vssver2.scc
BSE.Platten.Statistik.csproj.user
vssver2.scc
BSE.Platten.Tunes.csproj.user
vssver2.scc
Settings.settings
vssver2.scc
About.png
Album16.gif
AudioCD.png
AudioFile.png
AutoList.png
broadcast.png
BSE.png
BSEAbout.png
BSEsplash.png
BSEtunes.ico
BSE_16.png
cd_hoeren.png
coverflow.png
DataContainer_MoveNextHS.png
delete.gif
diskinfo.png
Filter2HS.png
FindHS.png
Folder256.png
FolderOpen256.png
Genre16.gif
Interpret16.gif
keinBild.gif
NewPlaylist16.gif
OptionsHS.png
PauseHS.png
RefreshDocViewHS.png
Removabledrive.png
saveHS.png
search.png
shuffle.png
Shuffle_icon.png
song.png
splash1.png
StopHS.png
TaskHS.png
TrackInfo.gif
vssver2.scc
wiedergabe16.gif
BSEadminSetup.vdproj
BSEtunesSetup.vdproj
BSE.CDDrives.DLL
BSE.Charts.DLL
BSE.Configuration.DLL
BSE.RemovableDrives.DLL
BSE.Shell.DLL
BSE.ThreadedShell.DLL
BSE.Windows.Forms.DLL
lame_enc.dll
MySQL.chm.zip
MySQL.chm
MySqlCreateDataBase5x.sql.zip
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using BSE.Windows.Forms;
using System.Runtime.InteropServices;
using System.Security.Permissions;

namespace BSE.Platten.Common
{
    public partial class BaseForm : Form
    {
        #region EventsPublic
        /// <summary>
        /// Occurs when the PanelColors have been changed.
        /// </summary>
        [Description("Occurs when the PanelColors have been changed.")]
        public event EventHandler<EventArgs> PanelColorsChanged;

        #endregion
        
        #region FieldsPrivate

        private BSE.Windows.Forms.ProfessionalColorTable m_professionalColorTable;
        private BSE.Windows.Forms.PanelColors m_panelColors;
        private BSE.Windows.Forms.PanelStyle m_ePanelStyle;
        private uint m_iQueryCancelAutoPlay;

        #endregion

        #region Properties
        /// <summary>
        /// Gets or sets the panelcolors table.
        /// </summary>
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public BSE.Windows.Forms.PanelColors PanelColors
        {
            get { return this.m_panelColors; }
            set
            {
                if (value != null)
                {
                    this.m_panelColors = value;
                    OnPanelColorsChanged(this, EventArgs.Empty);
                }
            }
        }
        /// <summary>
        /// Gets or sets the style of the panel.
        /// </summary>
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public BSE.Windows.Forms.PanelStyle PanelStyle
        {
            get { return this.m_ePanelStyle; }
            set { this.m_ePanelStyle = value; }
        }
        /// <summary>
        /// Gets or sets the ProfessionalColorTable
        /// </summary>
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public BSE.Windows.Forms.ProfessionalColorTable ProfessionalColorTable
        {
            get { return this.m_professionalColorTable; }
            set
            {
                if (value != null)
                {
                    this.m_professionalColorTable = value;
                    ChangeColors(this.ContentPanel);
                }
            }
        }
        #endregion

        #region MethodsPublic

        public BaseForm()
        {
            InitializeComponent();
            this.ContentPanel.Dock = DockStyle.Fill;
            this.m_ePanelStyle = PanelStyle.Office2007;
        }
        /// <summary>
        /// Change the colors for certain objects.
        /// </summary>
        /// <param name="control">the controls that should change the color</param>
        public void ChangeColors(Control control)
        {
            TextBox textBox = control as TextBox;
            if (textBox != null)
            {
                if (textBox.ReadOnly == true)
                {
                    Color backColor = ProfessionalColors.ToolStripContentPanelGradientBegin;
                    if (this.m_professionalColorTable != null)
                    {
                        backColor = this.m_professionalColorTable.ToolStripContentPanelGradientBegin;
                       	if (typeof(BSE.Windows.Forms.ProfessionalColorTable).IsAssignableFrom(this.m_professionalColorTable.GetType()))
                        {
                            textBox.ForeColor = this.m_professionalColorTable.MenuItemText;
                        }
                        else
                        {
                            textBox.ForeColor = SystemColors.ControlText;
                        }
                    }
                    textBox.BackColor = backColor;
                }
            }
            Label label = control as Label;
            if ((label != null)
                && (this.m_professionalColorTable != null)
                && (label.GetType() != typeof(UnchangeableLabel))
                && (typeof(BSE.Windows.Forms.ProfessionalColorTable).IsAssignableFrom(this.m_professionalColorTable.GetType())))
            {
                if (this.m_professionalColorTable != null)
                {
                    label.ForeColor = this.m_professionalColorTable.MenuItemText;
                }
            }
            CheckBox checkBox = control as CheckBox;
            if (checkBox != null)
            {
                if (this.m_professionalColorTable != null)
                {
                    checkBox.ForeColor = this.m_professionalColorTable.MenuItemText;
                }
            }
            GroupBox groupBox = control as GroupBox;
            if (groupBox != null)
            {
                if ((this.m_professionalColorTable != null)
                    && (typeof(BSE.Windows.Forms.ProfessionalColorTable).IsAssignableFrom(this.m_professionalColorTable.GetType())))
                {

                    groupBox.ForeColor = this.m_professionalColorTable.MenuItemText;
                }
                else
                {
                    groupBox.ForeColor = SystemColors.ControlText;
                }
            }
            if ((control != null) && (control.HasChildren == true))
            {
                // Recursively call this method for each child control.
                foreach (Control childControl in control.Controls)
                {
                    ChangeColors(childControl);
                }
            }
        }

        #endregion

        #region MethodsProtected
        /// <summary>
        /// Processes Windows messages.
        /// </summary>
        /// <param name="m">The Windows <see cref="Message"/> to process.</param>
        [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
        protected override void WndProc(ref Message m)
        {
            if (this.m_iQueryCancelAutoPlay == 0)
            {
                this.m_iQueryCancelAutoPlay = NativeMethods.RegisterWindowMessage("QueryCancelAutoPlay");
            }
            if (m.Msg == this.m_iQueryCancelAutoPlay)
            {
                m.Result = (IntPtr)1;
            }
            else
            {
                base.WndProc(ref m);
            }
        }
        /// <summary>
        /// Raises the System.Windows.Forms.Control.SystemColorsChanged event.
        /// </summary>
        /// <param name="e">A EventArgs that contains the event data.</param>
        protected override void OnSystemColorsChanged(EventArgs e)
        {
            ChangeColors(this.ContentPanel);
            base.OnSystemColorsChanged(e);
        }
        /// <summary>
        /// Raises the PanelColorsChanged event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A EventArgs that contains the event data.</param>
        protected virtual void OnPanelColorsChanged(object sender, EventArgs e)
        {
            if (this.m_panelColors != null)
            {
                BSE.Windows.Forms.PanelSettingsManager.SetPanelProperties(
                    this.ContentPanel.Controls,
                    this.m_ePanelStyle,
                    this.m_panelColors);
                this.Invalidate();
            }
            if (this.PanelColorsChanged != null)
            {
                this.PanelColorsChanged(sender, e);
            }
        }
        /// <summary>
        /// Raises the KeyUp event.
        /// </summary>
        /// <param name="e">A EventArgs that contains the event data.</param>
        protected override void OnKeyUp(KeyEventArgs e)
        {
            base.OnKeyUp(e);
            if (e.KeyCode == Keys.X)
            {
                if (e.Modifiers == Keys.Control)
                {
                    if (this.ContentPanel.BackgroundImage != null)
                    {
                        this.ContentPanel.BackgroundImage = null;
                    }
                }
            }
        }
        /// <summary>
        /// Raises the DragEnter event.
        /// </summary>
        /// <param name="drgevent">A DragEventArgs that contains the event data</param>
        protected override void OnDragEnter(DragEventArgs drgevent)
        {
            base.OnDragEnter(drgevent);
            if (drgevent.Data is DataObject)
            {
                drgevent.Effect = DragDropEffects.Move;
            }
        }
        /// <summary>
        /// Raises the DragDrop event.
        /// </summary>
        /// <param name="drgevent">A DragEventArgs that contains the event data</param>
        protected override void OnDragDrop(DragEventArgs drgevent)
        {
            base.OnDragDrop(drgevent);
            if (drgevent.Data is DataObject)
            {
                DataObject dataObject = drgevent.Data as DataObject;
                if (dataObject.ContainsFileDropList() == true)
                {
                    try
                    {
                        System.Collections.Specialized.StringCollection files = dataObject.GetFileDropList();
                        System.IO.FileInfo fileInfo = new System.IO.FileInfo(files[0]);
                        if (fileInfo.Exists == true)
                        {
                            if (BSE.Platten.BO.CCoverData.IsAllowedCoverExtension(fileInfo.Extension) == true)
                            {
                                Image image = Bitmap.FromFile(fileInfo.FullName);
                                if (image != null)
                                {
                                    this.ContentPanel.BackgroundImage = image;
                                    this.ContentPanel.BackgroundImageLayout = ImageLayout.Tile;
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
        #endregion

        #region MethodsPrivate

        internal class NativeMethods
        {
            /// <summary>
            /// The RegisterWindowMessage function defines a new window message that is guaranteed to be unique
            /// throughout the system. The message value can be used when sending or posting messages.
            /// </summary>
            /// <param name="lpString">Pointer to a null-terminated string that specifies the message to be registered.</param>
            /// <returns>If the message is successfully registered, the return value is a message identifier
            /// in the range 0xC000 through 0xFFFF.</returns>
            [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
            internal static extern uint RegisterWindowMessage(string lpString);
        }
        
        #endregion
    }

    public static class GlobalizedMessageBox
    {
        /// <summary>
        /// Displays a message box with the specified text, buttons, icon and builds the caption from
        /// the IWin32Window functions.
        /// </summary>
        /// <param name="owner">An implementation of IWin32Window that will own the modal dialog box.</param>
        /// <param name="text">The text to display in the message box.</param>
        /// <param name="buttons">One of the MessageBoxButtons values that specifies which buttons to display
        /// in the message box.</param>
        /// <param name="icon">One of the MessageBoxIcon values that specifies which icon to display
        /// in the message box</param>
        /// <returns></returns>
        public static DialogResult Show(IWin32Window owner, string text,MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            string strMessageBoxCaption = string.Empty;
            Form form = owner as Form;
            if (form != null)
            {
                strMessageBoxCaption = form.Text;
            }
            if (string.IsNullOrEmpty(strMessageBoxCaption) == true)
            {
                Control control = owner as Control;
                if (control != null)
                {
                    if (control.FindForm() != null)
                    {
                        strMessageBoxCaption = control.FindForm().Text;
                    }
                }
            }
            return Show(owner, text, strMessageBoxCaption, buttons, icon);
        }
        /// <summary>
        /// Displays a message box with the specified text, caption, buttons, icon.
        /// </summary>
        /// <param name="owner">An implementation of IWin32Window that will own the modal dialog box.</param>
        /// <param name="text">The text to display in the message box.</param>
        /// <param name="caption">The text to display in the title bar of the message box.</param>
        /// <param name="buttons">One of the MessageBoxButtons values that specifies which buttons to display
        /// in the message box.</param>
        /// <param name="icon">One of the MessageBoxIcon values that specifies which icon to display
        /// in the message box.</param>
        /// <returns></returns>
        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons,
            MessageBoxIcon icon)
        {
            MessageBoxOptions options = (MessageBoxOptions)0;
            MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1;
            return Show(owner, text, caption, buttons, icon, defaultButton, options);
        }
        /// <summary>
        /// Displays a message box in front of the specified object and with the specified text,
        /// caption, buttons, icon, default button, and options.
        /// </summary>
        /// <param name="owner">An implementation of IWin32Window that will own the modal dialog box.</param>
        /// <param name="text">The text to display in the message box.</param>
        /// <param name="caption">The text to display in the title bar of the message box.</param>
        /// <param name="buttons">One of the MessageBoxButtons values that specifies which buttons to display
        /// in the message box.</param>
        /// <param name="icon">One of the MessageBoxIcon values that specifies which icon to display in the message
        /// box.</param>
        /// <param name="defaultButton">One of the MessageBoxDefaultButton values the specifies the default button
        /// for the message box.</param>
        /// <param name="options">One of the MessageBoxOptions values that specifies which display and association
        /// options will be used for the message box. You may pass in 0 if you wish to use the defaults.</param>
        /// <returns></returns>
        public static DialogResult Show (IWin32Window owner,string text,string caption,MessageBoxButtons buttons,
            MessageBoxIcon icon,MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
        {
            if (IsRightToLeft(owner))
            {
                options |= MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign;
            }
            return MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);
        }

        private static bool IsRightToLeft(IWin32Window owner)
        {
            Control control = owner as Control;
            if (control != null)
            {
                return control.RightToLeft == RightToLeft.Yes;
            }
            // If no parent control is available, ask the CurrentUICulture
            // if we are running under right-to-left.
            return CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;
        }
    }
}

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)

Share

About the Author

Uwe Eichkorn

Switzerland Switzerland
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 24 Apr 2010
Article Copyright 2009 by Uwe Eichkorn
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid