- mysql.chm.zip
- MySQL.chm
- bse.platten_en.zip
- BSE.Platten
- BSE.CoverFlow.WPFLib
- BSE.Platten.Admin.WinApp
- BSE.Platten.Admin
- BSE.Platten.Audio
- BSE.Platten.BO
- BSE.Platten.Common
- BSE.Platten.Covers
- BSE.Platten.FreeDb
- BSE.Platten.Ripper
- BSE.Platten.sln
- BSE.Platten.Statistik
- BSE.Platten.Tunes
- BSEadminSetup
- BSEadminSetup.vdproj
- Debug
- Release
- BSEtunesSetup
- BSEtunesSetup.vdproj
- Debug
- Release
- dll
- BSE.CDDrives.DLL
- BSE.Charts.DLL
- BSE.Configuration.DLL
- BSE.RemovableDrives.DLL
- BSE.Shell.DLL
- BSE.ThreadedShell.DLL
- BSE.Windows.Forms.DLL
- Lame
- lame_enc.dll
- lame-3.97
- mysqlcreatedatabase5x.sql.zip
- BSE.Platten.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.BO;
using BSE.Platten.Common;
namespace BSE.Platten.Tunes.Filters
{
public partial class FilterMain : BaseForm
{
#region Events
public event EventHandler<FilterChangedEventArgs> FilterChanged;
#endregion
#region FieldsPrivate
private BSE.Platten.BO.Environment m_environment;
#endregion
#region Properties
public BSE.Platten.BO.Environment Environment
{
get { return this.m_environment; }
set { this.m_environment = value; }
}
#endregion
#region MethodsPublic
public FilterMain()
{
InitializeComponent();
}
public FilterMain(BSE.Platten.BO.Environment environment)
: this()
{
this.m_environment = environment;
}
public FilterConfiguration GetFilterConfiguration(BSE.Platten.BO.Environment environment)
{
this.m_environment = environment;
FilterConfiguration filterConfiguration = new FilterConfiguration();
Type typeOfInterface = typeof(IFilterConfiguration);
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly();
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
if (type.IsClass && typeOfInterface.IsAssignableFrom(type))
{
FilterBase filterBase = Activator.CreateInstance(type) as FilterBase;
if (filterBase != null)
{
FilterConfiguration tmpFilterConfiguration =
filterBase.GetFilterConfiguration(environment);
if (tmpFilterConfiguration.IsUsed == true)
{
filterConfiguration = tmpFilterConfiguration;
}
}
}
}
return filterConfiguration;
}
public BSE.Platten.BO.CTrackCollection GetTracksByFilterSettings(BSE.Platten.BO.Environment environment, FilterSettings filterSettings)
{
CTrackCollection trackCollection = null;
try
{
CTunesBusinessObject tunesBusinessObject = new CTunesBusinessObject(environment.GetConnectionString());
trackCollection = tunesBusinessObject.GetTracksByFilterSettings(filterSettings);
if (trackCollection.Count > 0)
{
string strAudioHomeDirectory = CAlbum.GetAudioHomeDirectory(this.m_environment);
System.Collections.IEnumerator enumerator = trackCollection.GetEnumerator();
while (enumerator.MoveNext())
{
CTrack track = enumerator.Current as CTrack;
if (track != null)
{
track.FileFullName = strAudioHomeDirectory + track.FileName;
}
}
}
}
catch (BSE.Configuration.ConfigurationValueNotFoundException)
{
throw;
}
catch (Exception)
{
throw;
}
return trackCollection;
}
#endregion
#region MethodsProtected
#endregion
#region MethodsPrivate
private void FilterMainLoad(object sender, EventArgs e)
{
if (this.m_environment != null)
{
TabControl.TabPageCollection tabPageCollection = this.m_tabFilters.TabPages;
foreach (TabPage tabPage in tabPageCollection)
{
Type typeOfInterface = typeof(IFilterConfiguration);
if (typeOfInterface.IsAssignableFrom(tabPage.Controls[0].GetType()))
{
FilterBase filterBase = tabPage.Controls[0] as FilterBase;
if (filterBase != null)
{
filterBase.SetFilterValues(this.m_environment);
}
}
}
}
}
private void FilterCheckStateChanged(object sender, FilterCheckStateChangeEventArgs e)
{
foreach (Control control in this.m_pnlUsingFilters.Controls)
{
CheckBox checkBox = control as CheckBox;
if (checkBox != null)
{
if (checkBox.Tag == e.CheckBox.Tag)
{
checkBox.Enabled = e.CheckState;
if (!checkBox.Enabled)
{
checkBox.Checked = checkBox.Enabled;
}
}
}
}
}
private void FilterAdded(object sender, FilterNotificationEventArgs e)
{
bool bCheckBoxAvailable = false;
int iCheckBoxTop = 10;
foreach (Control control in this.m_pnlUsingFilters.Controls)
{
CheckBox checkBox = control as CheckBox;
if (checkBox != null)
{
iCheckBoxTop = checkBox.Top + checkBox.Height;
if (checkBox.Tag == e.CheckBox.Tag)
{
bCheckBoxAvailable = false;
}
}
}
if (bCheckBoxAvailable == false)
{
e.CheckBox.Left = 10;
e.CheckBox.Top = iCheckBoxTop;
e.CheckBox.Width = this.m_pnlUsingFilters.Width - e.CheckBox.Left;
e.CheckBox.CheckedChanged += new System.EventHandler(this.UsingFiltersCheckedChanged);
this.m_pnlUsingFilters.Controls.Add(e.CheckBox);
}
}
private void UsingFiltersCheckedChanged(object sender, System.EventArgs e)
{
CheckBox checkBox = sender as CheckBox;
if (checkBox != null)
{
if (checkBox.Checked)
{
foreach (Control control in this.m_pnlUsingFilters.Controls)
{
CheckBox tmpCheckBox = control as CheckBox;
if (tmpCheckBox != null)
{
if (tmpCheckBox.Tag != checkBox.Tag)
{
tmpCheckBox.Checked = false;
}
}
}
}
}
}
private void BtnOKClick(object sender, EventArgs e)
{
foreach (Control control in this.m_pnlUsingFilters.Controls)
{
CheckBox checkBox = control as CheckBox;
if (checkBox != null)
{
TabControl.TabPageCollection tabPageCollection = this.m_tabFilters.TabPages;
foreach (TabPage tabPage in tabPageCollection)
{
if (tabPage.Controls[0].GetType() == checkBox.Tag)
{
FilterBase filterBase = tabPage.Controls[0] as FilterBase;
if (filterBase != null)
{
filterBase.SafeFilterConfiguration(this.m_environment, checkBox.Checked);
}
}
}
}
}
if (FilterChanged != null)
{
FilterChanged(this,new FilterChangedEventArgs());
}
}
#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 member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.