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

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
MySqlCreateDataBase5x.sql.zip
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.BO;
using BSE.Platten.Tunes.Properties;
using BSE.Platten.Common;
using System.Globalization;

namespace BSE.Platten.Tunes
{
    public partial class TreeInterpretenTitel : UserControl
    {
        #region Enums

        public enum TreeViewMode
        {
            Interprets,
            Genre,
            Year
        }

        #endregion

        #region Events

        public event EventHandler<TreeInterpretenTitelEventArgs> TitelAfterSelect;

        #endregion

        #region FieldsPrivate

        #endregion

        #region MethodsPublic

        public TreeInterpretenTitel()
        {
            InitializeComponent();
            Image imgInterpret = Resources.Interpret16;
            Image imgAlbum = Resources.Album16;
            Image imgGenre = Resources.Genre16;
            this.m_imgList.Images.AddRange(new Image[] {
                imgInterpret,
                imgAlbum,
                imgGenre});
        }
        public void SetInterpretsAndAlbums(CInterpretData[] interpretsAndAlbums)
        {
            if (interpretsAndAlbums == null)
            {
                throw new ArgumentNullException(
                    string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.IDS_ArgumentNullException,"interpretsAndAlbums"));
            }
            
            this.m_trvInterpretenTitel.Nodes.Clear();
            try
            {
                foreach (BSE.Platten.BO.CInterpretData interpret in interpretsAndAlbums)
                {
                    TreeNode treeNode = new TreeNode(interpret.Interpret);
                    treeNode.ImageIndex = 0;
                    treeNode.SelectedImageIndex = 0;
                    if (interpret.Albums != null)
                    {
                        AddTreeChilds(interpret.Albums, treeNode, TreeViewMode.Interprets);
                    }
                    this.m_trvInterpretenTitel.Nodes.Add(treeNode);
                }
            }
            catch (Exception exception)
            {
                GlobalizedMessageBox.Show(this,exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }

        public void SetGenresWithAlbums(CGenreData[] genresWithAlbums)
        {
            if (genresWithAlbums == null)
            {
                throw new ArgumentNullException(
                    string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.IDS_ArgumentNullException,"genresWithAlbums"));
            }
            
            this.m_trvGenreInterpretsAndTitles.Nodes.Clear();
            try
            {
                foreach (BSE.Platten.BO.CGenreData genre in genresWithAlbums)
                {
                    TreeNode treeNode = new TreeNode(genre.Genre);
                    treeNode.ImageIndex = 2;
                    treeNode.SelectedImageIndex = 2;
                    if (genre.Albums != null)
                    {
                        AddTreeChilds(genre.Albums, treeNode, TreeViewMode.Genre);
                    }
                    this.m_trvGenreInterpretsAndTitles.Nodes.Add(treeNode);
                }
            }
            catch (Exception exception)
            {
                GlobalizedMessageBox.Show(this, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }

        public void SetYearsWithAlbums(CYearData[] yearsWithAlbums)
        {
            if (yearsWithAlbums == null)
            {
                throw new ArgumentNullException(
                    string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.IDS_ArgumentNullException,"yearsWithAlbums"));
            }
            
            this.m_trvYearInterpretsAndTitles.Nodes.Clear();
            try
            {
                foreach (BSE.Platten.BO.CYearData year in yearsWithAlbums)
                {
                    TreeNode treeNode = new TreeNode(year.Year.ToString(CultureInfo.InvariantCulture));
                    treeNode.ImageIndex = 2;
                    treeNode.SelectedImageIndex = 2;
                    if (year.Albums != null)
                    {
                        AddTreeChilds(year.Albums, treeNode, TreeViewMode.Year);
                    }
                    this.m_trvYearInterpretsAndTitles.Nodes.Add(treeNode);
                }
            }
            catch (Exception exception)
            {
                GlobalizedMessageBox.Show(this, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }

        public void SetSelectedChildNode(int iTitelId)
        {
            TabPage tabPage = this.m_tabMain.SelectedTab;
            if (tabPage != null)
            {
                TreeView treeView = tabPage.Controls[0] as TreeView;
                if (treeView != null)
                {
                    foreach (TreeNode node in treeView.Nodes)
                    {
                        foreach (TreeNode childNode in node.Nodes)
                        {
                            TreeInterpretenTitelChildNode treeInterpretenTitelChildNode = childNode as TreeInterpretenTitelChildNode;
                            if ((treeInterpretenTitelChildNode != null) && (treeInterpretenTitelChildNode.TitelId == iTitelId))
                            {
                                treeView.SelectedNode = treeInterpretenTitelChildNode;
                                treeInterpretenTitelChildNode.BackColor = SystemColors.Highlight;
                                treeInterpretenTitelChildNode.ForeColor = SystemColors.HighlightText;
                            }
                        }
                    }
                }
            }
        }

        #endregion

        #region MethodsProtected
        #endregion

        #region MethodsPrivate

        private static void AddTreeChilds(BSE.Platten.BO.CAlbum[] albums, TreeNode treeNode, TreeViewMode treeViewMode)
        {
            foreach (BSE.Platten.BO.CAlbum album in albums)
            {
                TreeInterpretenTitelChildNode treeTitelChildNode = new TreeInterpretenTitelChildNode();
                if (treeViewMode == TreeViewMode.Interprets)
                {
                    treeTitelChildNode.Text = album.Title;
                }
                if (treeViewMode == TreeViewMode.Genre)
                {
                    treeTitelChildNode.Text = album.Interpret + " - " + album.Title;
                }
                if (treeViewMode == TreeViewMode.Year)
                {
                    treeTitelChildNode.Text = album.Interpret + " - " + album.Title;
                }
                treeTitelChildNode.TitelId = album.AlbumId;
                treeTitelChildNode.ImageIndex = 1;
                treeTitelChildNode.SelectedImageIndex = 1;
                treeNode.Nodes.Add(treeTitelChildNode);
            }
        }

        private void TreeViewItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
        {
            TreeInterpretenTitelChildNode treeNode = e.Item as TreeInterpretenTitelChildNode;
            if (treeNode != null)
            {
                PlayListDragDropData playListDragDropData = new PlayListDragDropData();
                playListDragDropData.Id = treeNode.TitelId;
                playListDragDropData.PlayListDragDropMode = PlayList.PlayListDragDropMode.Albums;

                BSE.Windows.Forms.CDraggedListViewObjects draggedListViewObjects
                    = new BSE.Windows.Forms.CDraggedListViewObjects(new BSE.Windows.Forms.ListView(DragDropEffects.Move));
                draggedListViewObjects.DragObjects.Add(playListDragDropData);
                BSE.Windows.Forms.CDataObject dataObject = new BSE.Windows.Forms.CDataObject(draggedListViewObjects);

                DoDragDrop(dataObject, DragDropEffects.Move);
            }
        }
        
        private void TreeViewBeforeSelect(object sender, TreeViewCancelEventArgs e)
        {
            System.Windows.Forms.TabControl.TabPageCollection tabPages = this.m_tabMain.TabPages;
            foreach (TabPage tabPage in tabPages)
            {
                if (tabPage != null)
                {
                    TreeView treeView = tabPage.Controls[0] as TreeView;
                    if (treeView != null)
                    {
                        TreeNode selectedTreeNode = treeView.SelectedNode;
                        if (selectedTreeNode != null)
                        {
                            selectedTreeNode.BackColor = SystemColors.Window;
                            selectedTreeNode.ForeColor = SystemColors.WindowText;
                        }
                    }
                }
            }
        }
        
        private void TreeViewAfterSelect(object sender, TreeViewEventArgs e)
        {
            TabPage selectedTabPage = this.m_tabMain.SelectedTab;
            TreeView treeView = selectedTabPage.Controls[0] as TreeView;
            if (treeView != null)
            {
                TreeNode selectedTreeNode = treeView.SelectedNode;
                if (selectedTreeNode != null)
                {
                    selectedTreeNode.BackColor = SystemColors.Highlight;
                    selectedTreeNode.ForeColor = SystemColors.HighlightText;
                }
            }
            if (e.Action != TreeViewAction.Unknown)
            {
                TreeInterpretenTitelChildNode treeTitelChildNode = e.Node as TreeInterpretenTitelChildNode;
                if (treeTitelChildNode != null)
                {
                    if (TitelAfterSelect != null)
                    {
                        TitelAfterSelect(this, new TreeInterpretenTitelEventArgs(e.Node, e.Action, treeTitelChildNode.TitelId));
                    }
                }
            }
        }

        private void TreeViewMouseUp(object sender, MouseEventArgs e)
        {
            TreeView treeView = sender as TreeView;
            if (treeView != null)
            {
                TreeNode treeNode = treeView.GetNodeAt(e.X, e.Y) as TreeNode;
                if (treeNode == null)
                {
                    return;
                }
                if (treeNode.IsSelected == false)
                {
                    treeView.SelectedNode = treeNode;
                }

                TreeInterpretenTitelChildNode treeChildNode = treeNode as TreeInterpretenTitelChildNode;
                if (treeChildNode != null)
                {
                    if (TitelAfterSelect != null)
                    {
                        TitelAfterSelect(this, new TreeInterpretenTitelEventArgs(treeChildNode, TreeViewAction.ByMouse, treeChildNode.TitelId));
                    }
                }
            }
        }

        private void m_tabMain_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            TabPage tabPage = m_tabMain.SelectedTab;
            foreach (Control control in tabPage.Controls)
            {
                TreeView treeView = (TreeView)control;
                if (treeView != null)
                {
                    treeView.Focus();
                }
            }
        }

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

Share

About the Author

Uwe Eichkorn

Switzerland Switzerland
No Biography provided

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