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

BSEtunes

, 24 Apr 2010 CPOL
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 BSE.Platten.Admin.Properties;
using BSE.Platten.BO;
using BSE.Platten.Common;
using System.Globalization;
using System.Security.Permissions;

namespace BSE.Platten.Admin
{
    public partial class BaseDataForm : BaseForm, IConfigurationSettings
    {
        #region Constants

        private const string m_strSettingsFileNameSettingsPart = ".Settings";

        #endregion

        #region Events

        public event EventHandler<HostAvailableEventArgs> HostAvailable;
        public event EventHandler NewRecord;
        public event EventHandler ClearSearch;
        public event EventHandler ExecuteSearch;
        public event EventHandler SaveRecords;
        public event EventHandler UnDo;
        public event EventHandler PositionChanged;
        public event EventHandler<ViewStateChangeEventArgs> ViewStateChanged;
        public event EventHandler DataChanged;
        public event DataColumnChangeEventHandler ColumnChanged;
        public event DataColumnChangeEventHandler ColumnChanging;

        #endregion

        #region FieldsPrivate

        private BSE.Platten.BO.Environment m_environment;
        private BSE.Platten.Common.CToolStripStatusLabelCheckDB m_ttslCheckDb;
        private VScrollBar m_vsbPaging;

        #endregion

        #region Properties

        #region IConfigurationSettings

        public string ConfigurationFolder
        {
            get { return this.GetType().Namespace; }
        }

        public string ConfigurationFileName
        {
            get { return this.GetType().Namespace; }
        }

        public string SettingsFileName
        {
            get { return ConfigurationFileName + m_strSettingsFileNameSettingsPart; }
        }
        
        #endregion
        /// <summary>
        /// Gets or sets the <see cref="BSE.Configuration.Configuration"/> object with the system environment settings.
        /// </summary>
        public BSE.Configuration.Configuration Configuration
        {
            get;
            set;
        }
        /// <summary>
        /// Gets or sets the <see cref="BSE.Configuration.Configuration"/> object with the form settings.
        /// </summary>
        public BSE.Configuration.Configuration Settings
        {
            get;
            set;
        }

        public BSE.Platten.BO.Environment Environment
        {
            get { return this.m_environment; }
            set
            {
                this.m_environment = value;
                if (this.m_ttslCheckDb != null)
                { 
                    this.m_ttslCheckDb.Environment = this.m_environment;
                }
            }
        }

        public VScrollBar VScrollBar
        {
            get { return m_vsbPaging; }
            set
            {
                this.m_vsbPaging = value;
                this.m_vsbPaging.Scroll += new ScrollEventHandler(VScrollBarScroll);
                this.m_vsbPaging.ValueChanged += new EventHandler(VScrollBarValueChanged);
            }
        }
        /// <summary>
        /// Gets or sets the <see cref="DataSet"/> object for the forms data.
        /// </summary>
        public DataSet DataSet
        {
            get;
            set;
        }

        public BindingSource BindingSource
        {
            get { return this.m_bindingSource; }
        }
        /// <summary>
        /// Gets or sets the connection string.
        /// </summary>
        protected string ConnectionString
        {
            get;
            set;
        }

        public ErrorProvider ErrorProvider
        {
            get { return this.m_errProvider; }
        }
        /// <summary>
        /// Gets or sets the <see cref="DataFormViewMode"/>
        /// </summary>
        protected DataFormViewMode DataFormViewMode
        {
            get;
            set;
        }

        public ToolStrip ToolStripDateBase
        {
            get { return this.m_tsDataBase; }
            set { this.m_tsDataBase = value; }
        }

        public MenuStrip MenuStripBase
        {
            get { return this.m_msBase; }
            set { this.m_msBase = value; }
        }

        public ToolStripPanel ToolStripPanelLeft
        {
            get { return this.m_tspLeft; }
            set { this.m_tspLeft = value; }
        }

        public ToolStripPanel ToolStripPanelRight
        {
            get { return this.m_tspRight; }
            set { this.m_tspRight = value; }
        }

        public ToolStripPanel ToolStripPanelTop
        {
            get { return this.m_tspTop; }
            set { this.m_tspTop = value; }
        }

        public ToolStripPanel ToolStripPanelBottom
        {
            get { return this.m_tspBottom; }
            set { this.m_tspBottom = value; }
        }
        protected DatabaseHostAvailability DatabaseHostAvailability
        {
            get { return this.m_ttslCheckDb.DatabaseHostAvailability; }
        }
        #endregion

        #region MethodsPublic

        public BaseDataForm()
        {
            InitializeComponent();
            this.m_tspTop.Join(this.m_tsDataBase);

            this.m_ttslCheckDb = new BSE.Platten.Common.CToolStripStatusLabelCheckDB();
            this.m_ttslCheckDb.TextAlign = ContentAlignment.MiddleLeft;
            this.m_ssBase.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.m_ttslCheckDb});

            this.DataFormViewMode = DataFormViewMode.Clear;

        }

        #endregion

        #region MethodsProtected

        protected void SetUnDo(bool bUnDo)
        {
            this.ErrorProvider.Clear();
            this.m_btnEdit_Undo.Enabled = this.m_mnuEdit_Undo.Enabled = bUnDo;
        }

        protected void SetPanelInformation(string strInformation)
        {
            this.m_tslblComment.Text = strInformation;
        }

        protected bool IsHostAvailable(BSE.Platten.BO.Environment environment)
        {
            return this.m_ttslCheckDb.IsHostAvailable(environment);
        }

        protected virtual bool ValidateForm()
        {
            // Code logic in derived Form
            return true;
        }

        protected virtual bool ConfirmChanges()
        {
            // Code logic in derived Form
            return true;
        }

        protected void ResetBinding()
        {
            this.ErrorProvider.Clear();
            if (this.BindingSource != null)
            {
                this.BindingSource.EndEdit();
                this.BindingSource.PositionChanged -= OnPositionChanged;

                if (this.DataSet != null)
                {
                    this.DataSet.Clear();
                }
            }
        }
        /// <summary>
        /// Raises the Load event.
        /// </summary>
        /// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            foreach (Control control in this.Controls)
            {
                if (control.GetType() == typeof(MenuStrip))
                {
                    MenuStrip childMenuStrip = (MenuStrip)control;
                    if (childMenuStrip != this.m_msBase)
                    {
                        childMenuStrip.Visible = false;
                        ToolStripManager.Merge(childMenuStrip, this.m_msBase);
                    }
                }
            }

            if (this.m_environment != null)
            {
                try
                {
                    this.ConnectionString = this.m_environment.GetConnectionString();
                    this.m_ttslCheckDb.HostAvailabilityChanged += OnHostAvailable;

                    if (this.IsHostAvailable(this.m_environment) == true)
                    {
                        base.OnLoad(e);
                    }
                }
                catch (BSE.Configuration.ConfigurationValueNotFoundException)
                {
                    throw;
                }
            }
        }
        /// <summary>
        /// Raises the Closing event.
        /// </summary>
        /// <param name="e">A <see cref="CancelEventArgs"/> that contains the event data.</param>
        protected override void OnClosing(CancelEventArgs e)
        {
            this.m_ttslCheckDb.HostAvailabilityChanged -= OnHostAvailable;
            if (this.VScrollBar != null)
            {
                this.VScrollBar.Scroll -= new ScrollEventHandler(VScrollBarScroll);
                this.VScrollBar.ValueChanged -= new EventHandler(VScrollBarValueChanged);
            }
            base.OnClosing(e);
        }
        /// <summary>
        /// Raises the HostAvailable event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="HostAvailableEventArgs"/> that contains the event data.</param>
        protected virtual void OnHostAvailable(object sender,HostAvailableEventArgs e)
        {
            this.ResetBinding();
            DatabaseHostAvailability databaseHostAvailability = e.DatabaseHostAvailability;
            if (databaseHostAvailability != null)
            {
                if (databaseHostAvailability.IsAvailable == false)
                {
                    //All controls which could manipulate data are disabled.
                    foreach (ToolStripItem item in this.m_msBase.Items)
                    {
                        if (item != this.m_mnuDatei)
                        {
                            item.Enabled = false;
                        }
                    }
                    this.m_tsDataBase.Enabled = false;
                }
                else
                {
                    this.Environment.UserGrant = databaseHostAvailability.UserGrant;
                    //All controls which could manipulate data are enabled.
                    foreach (ToolStripItem item in this.m_msBase.Items)
                    {
                        item.Enabled = true;
                    }
                    this.m_tsDataBase.Enabled = true;
                }

                if (HostAvailable != null)
                {
                    HostAvailable(this, e);
                }
            }
        }
        /// <summary>
        /// Raises the DataChanged event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param>
        protected virtual void OnDataChanged(object sender, System.EventArgs e)
        {
            if (this.DataChanged != null)
            {
                this.DataChanged(this, e);
            }
        }
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
        protected virtual void OnClearSearch(object sender, EventArgs e)
        {
            if (ClearSearch != null)
            {
                ClearSearch(sender, e);
            }

            this.m_tslblNavigation.Text = string.Empty;
            if (this.VScrollBar != null)
            {
                this.VScrollBar.Enabled = false;
            }

            this.ResetBinding();
            OnViewStateChanged(sender, new ViewStateChangeEventArgs(DataFormViewMode.Clear));
        }

        protected virtual void OnExecuteSearch(object sender, EventArgs e)
        {
            if (ExecuteSearch != null)
            {
                ExecuteSearch(sender, e);
            }
        }
        
        protected virtual void OnNewRecord(object sender, EventArgs e)
        {
            OnViewStateChanged(sender, new ViewStateChangeEventArgs(DataFormViewMode.Insert));
            this.m_bindingSource.AddNew();

            if (NewRecord != null)
            {
                NewRecord(sender, e);
            }
        }

        protected virtual void OnSaveRecords(object sender, EventArgs e)
        {
            if (ValidateForm() == true)
            {
                this.BindingSource.EndEdit();
                if (SaveRecords != null)
                {
                    SaveRecords(sender, e);
                }
            }
        }

        protected virtual void OnUnDo(object sender, EventArgs e)
        {
            this.BindingSource.CancelEdit();
            //Clear all old errors
            foreach (DataTable dataTable in this.DataSet.Tables)
            {
                DataRow[] dataRowErrors = dataTable.GetErrors();
                foreach (DataRow dataRow in dataRowErrors)
                {
                    dataRow.ClearErrors();
                }
            }
            //Reset the dataset
            this.DataSet.RejectChanges();
            this.ErrorProvider.Clear();
            this.m_tslblComment.Text = string.Empty;
            this.m_mnuEdit_Undo.Enabled = this.m_btnEdit_Undo.Enabled = false;
            //ist die aktuelle Position = -1,
            //dann wurde vor dem Insert kein Datensatz selektiert
            if (this.BindingSource.Position == -1)
            {
                //und der auf neue Suche umgeschaltet
                OnClearSearch(sender, e);
            }
            if (this.BindingSource.Position != -1)
            {
                //wenn der Insert abgebrochen wird,
                if (this.DataFormViewMode == DataFormViewMode.Insert)
                {
                    //dann wird der DataViewMode zur�ckgesetzt
                    //this.DataViewMode = DataFormViewMode.Select;
                    OnViewStateChanged(sender,new ViewStateChangeEventArgs(DataFormViewMode.Select));
                    //die Position nachgef�hrt
                    OnPositionChanged(sender, e);
                    //und der ViewState neu gesetzt
                    
                }
            }

            if (UnDo != null)
            {
                UnDo(sender, e);
            }
        }

        protected virtual void OnViewStateChanged(object sender, ViewStateChangeEventArgs e)
        {
            this.DataFormViewMode = e.DataFormViewMode;
            switch (this.DataFormViewMode)
            {
                case DataFormViewMode.Clear:
                    this.m_mnuEdit_Undo.Enabled = this.m_btnEdit_Undo.Enabled = false;
                    this.m_mnuSuchen_Neu.Enabled = this.m_btnSuche_Neu.Enabled = false;
                    this.m_mnuSuchen_Ausf�hren.Enabled = this.m_btnSuchen_Ausf�hren.Enabled = true;
                    this.m_mnuDatensatz_Speichern.Enabled = this.m_btnDatensatz_Speichern.Enabled = false;
                    this.m_btnFirstRecord.Enabled = false;
                    this.m_btnPreviousRecord.Enabled = false;
                    this.m_btnNextRecord.Enabled = false;
                    this.m_btnLastRecord.Enabled = false;

                    this.m_tslblComment.Text = String.Empty;

                    if (this.Environment.UserGrant != null)
                    {
                        if (this.Environment.UserGrant.Grant == true)
                        {
                            this.m_mnuDatensatz_Neu.Enabled = this.m_btnDatensatz_Neu.Enabled = true;
                        }
                        else
                        {
                            this.m_mnuDatensatz_Neu.Enabled = this.m_btnDatensatz_Neu.Enabled = false;
                        }
                    }
                    break;
                case DataFormViewMode.Select:
                    this.m_mnuSuchen_Neu.Enabled = this.m_btnSuche_Neu.Enabled = true;
                    this.m_mnuSuchen_Ausf�hren.Enabled = this.m_btnSuchen_Ausf�hren.Enabled = false;

                    if (this.Environment.UserGrant.Grant == true)
                    {
                        this.m_mnuDatensatz_Neu.Enabled = this.m_btnDatensatz_Neu.Enabled = true;
                        this.m_mnuDatensatz_Speichern.Enabled = this.m_btnDatensatz_Speichern.Enabled = true;
                    }
                    else
                    {
                        this.m_mnuDatensatz_Neu.Enabled = this.m_btnDatensatz_Neu.Enabled = false;
                        this.m_mnuDatensatz_Speichern.Enabled = this.m_btnDatensatz_Speichern.Enabled = false;
                    }
                    break;
                case DataFormViewMode.Insert:
                    this.m_mnuSuchen_Neu.Enabled = this.m_btnSuche_Neu.Enabled = true;
                    this.m_mnuSuchen_Ausf�hren.Enabled = this.m_btnSuchen_Ausf�hren.Enabled = false;
                    this.m_mnuDatensatz_Neu.Enabled = this.m_btnDatensatz_Neu.Enabled = false;
                    this.m_mnuDatensatz_Speichern.Enabled = this.m_btnDatensatz_Speichern.Enabled = true;
                    this.m_mnuEdit_Undo.Enabled = this.m_btnEdit_Undo.Enabled = true;

                    if (this.m_vsbPaging != null)
                    {
                        this.m_vsbPaging.Enabled = false;
                    }

                    this.m_btnFirstRecord.Enabled =
                        this.m_btnPreviousRecord.Enabled =
                        this.m_btnNextRecord.Enabled =
                        this.m_btnLastRecord.Enabled = false;
                    break;
            }
            if (ViewStateChanged != null)
            {
                ViewStateChanged(sender, e);
            }
        }

        protected virtual void OnPositionChanged(object sender, EventArgs e)
        {
            if (this.DataFormViewMode == DataFormViewMode.Insert)
            {
                return;
            }

            if (this.m_bindingSource.Count == 0)
            {
                this.VScrollBar.Enabled = false;
            }
            else
            {
                this.VScrollBar.Enabled = true;
                this.VScrollBar.Minimum = 1;
                this.VScrollBar.Maximum = this.m_bindingSource.Count;
                this.VScrollBar.Value = this.m_bindingSource.Position + 1;

                if (this.m_bindingSource.Position == 0)
                {
                    this.m_btnFirstRecord.Enabled = false;
                    this.m_btnPreviousRecord.Enabled = false;
                }
                else
                {
                    this.m_btnFirstRecord.Enabled = true;
                    this.m_btnPreviousRecord.Enabled = true;
                }

                if (this.m_bindingSource.Position == this.m_bindingSource.Count - 1)
                {
                    this.m_btnNextRecord.Enabled = false;
                    this.m_btnLastRecord.Enabled = false;
                }
                else
                {
                    this.m_btnNextRecord.Enabled = true;
                    this.m_btnLastRecord.Enabled = true;
                }
            }

            this.m_tslblNavigation.Text = String.Format(CultureInfo.CurrentUICulture,Resources.IDS_FormRecordCountInformation,
                this.m_bindingSource.Position + 1,
                this.m_bindingSource.Count);

            if (this.PositionChanged != null)
            {
                this.PositionChanged(sender, e);
            }
        }

        protected virtual void OnColumnChanged(object sender, DataColumnChangeEventArgs e)
        {
            this.m_mnuEdit_Undo.Enabled = this.m_btnEdit_Undo.Enabled = true;
            this.m_tslblComment.Text = Resources.IDS_FormRecordChangedInformation;
            if (this.ColumnChanged != null)
            {
                this.ColumnChanged(sender, e);
            }
        }

        protected virtual void OnColumnChanging(object sender, DataColumnChangeEventArgs e)
        {
            if (this.ColumnChanging != null)
            {
                this.ColumnChanging(sender, e);
            }
        }

        #endregion

        #region MethodsPrivate

        private void m_mnuDatei_Beenden_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        
        private void m_mnuEdit_Undo_Click(object sender, EventArgs e)
        {
            OnUnDo(sender, e);
        }
        
        private void m_mnuSuchen_Neu_Click(object sender, EventArgs e)
        {
            OnClearSearch(sender, e);
        }

        private void m_mnuSuchen_Ausf�hren_Click(object sender, EventArgs e)
        {
            OnExecuteSearch(sender, e);
        }
        
        private void m_mnuDatensatz_Neu_Click(object sender, EventArgs e)
        {
            OnNewRecord(sender, e);
        }
        
        private void m_mnuDatensatz_Speichern_Click(object sender, EventArgs e)
        {
            OnSaveRecords(sender, e);
        }

        private void m_btnFirstRecord_Click(object sender, EventArgs e)
        {
            MoveFirst();
        }

        private void m_btnPreviousRecord_Click(object sender, EventArgs e)
        {
            MovePrevious();
        }

        private void m_btnNextRecord_Click(object sender, EventArgs e)
        {
            MoveNext();
        }

        private void m_btnLastRecord_Click(object sender, EventArgs e)
        {
            MoveLast();
        }

        private void MoveFirst()
        {
            if (ValidateForm() == true)
            {
                this.m_bindingSource.MoveFirst();
            }
        }

        private void MovePrevious()
        {
            if (ValidateForm() == true)
            {
                this.m_bindingSource.MovePrevious();
            }
        }

        private void MoveNext()
        {
            if (ValidateForm() == true)
            {
                this.m_bindingSource.MoveNext();
            }
        }

        private void MoveLast()
        {
            if (ValidateForm() == true)
            {
                this.m_bindingSource.MoveLast();
            }
        }

        private void CBaseDataForm_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Next:
                    if (this.DataFormViewMode == DataFormViewMode.Insert)
                    {
                        return;
                    }
                    if (e.Modifiers == Keys.None)
                    {
                        MoveNext();
                    }
                    if (e.Modifiers == Keys.Control)
                    {
                        MoveLast();
                    }
                    break;
                case Keys.Prior:
                    if (this.DataFormViewMode == DataFormViewMode.Insert)
                    {
                        return;
                    }
                    if (e.Modifiers == Keys.None)
                    {
                        MovePrevious();
                    }
                    if (e.Modifiers == Keys.Control)
                    {
                        MoveFirst();
                    }
                    break;
            }
        }

        private void VScrollBarScroll(object sender, ScrollEventArgs e)
        {
            if (ValidateForm() == true)
            {
                this.m_bindingSource.Position = this.m_vsbPaging.Value - 1;
            }
        }
        private void VScrollBarValueChanged(object sender, EventArgs e)
        {
            if (ValidateForm() == false)
            {
                this.VScrollBar.Value = this.BindingSource.Position + 1;
            }
        }
        private void PanelContentResize(object sender, EventArgs e)
        {
            this.m_toolstripContentPanel.ClientSize = this.ContentPanel.ClientSize;
        }
        #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
Web02 | 2.8.141022.2 | Last Updated 24 Apr 2010
Article Copyright 2009 by Uwe Eichkorn
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid