- 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
- mysql.chm.zip
- MySQL.chm
- mysqlcreatedatabase5x.sql.zip
- BSE.Platten.zip
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using BSE.Platten.Common.Properties;
using System.Reflection;
namespace BSE.Platten.Common
{
public partial class RenderStyleConfigurationControl : BaseConfigurationControl
{
#region MethodsPublic
public RenderStyleConfigurationControl()
{
InitializeComponent();
}
public override void SaveConfigurationValues(BSE.Configuration.Configuration configuration)
{
if (configuration == null)
{
throw new ArgumentNullException("configuration",
string.Format(System.Globalization.CultureInfo.InvariantCulture,
Resources.IDS_ArgumentNullException,
"configuration"));
}
RenderStyleConfigurationData configurationObject = new RenderStyleConfigurationData();
RenderStyle renderStyle = this.m_cboRenderers.SelectedItem as RenderStyle;
if (renderStyle != null)
{
if (renderStyle.TypeToolStripProfessionalRenderer != null)
{
ToolStripProfessionalRenderer toolStripProfessionalRenderer =
Activator.CreateInstance(renderStyle.TypeToolStripProfessionalRenderer) as ToolStripProfessionalRenderer;
if (toolStripProfessionalRenderer != null)
{
BSE.Windows.Forms.ProfessionalColorTable colorTable = toolStripProfessionalRenderer.ColorTable as BSE.Windows.Forms.ProfessionalColorTable;
if (colorTable != null)
{
renderStyle.TypeProfessionalColorTable = colorTable.GetType();
renderStyle.TypePanelColors = colorTable.PanelColorTable.GetType();
}
}
}
if (renderStyle.TypeToolStripProfessionalRenderer == typeof(BSE.Windows.Forms.BseRenderer))
{
renderStyle.PanelStyle = BSE.Windows.Forms.PanelStyle.Office2007;
}
if (renderStyle.TypeToolStripProfessionalRenderer == typeof(BSE.Windows.Forms.Office2007Renderer))
{
renderStyle.PanelStyle = BSE.Windows.Forms.PanelStyle.Office2007;
}
}
Type typeProfessionalColorTable = this.m_cboProfessionalColorTable.SelectedItem as Type;
if (typeProfessionalColorTable != null)
{
BSE.Windows.Forms.ProfessionalColorTable colorTable =
Activator.CreateInstance(typeProfessionalColorTable) as BSE.Windows.Forms.ProfessionalColorTable;
if (colorTable != null)
{
renderStyle.TypeProfessionalColorTable = colorTable.GetType();
renderStyle.TypePanelColors = colorTable.PanelColorTable.GetType();
}
}
configurationObject.RenderStyle = renderStyle;
configuration.SetValue(
OptionsConfiguration,
typeof(RenderStyleConfigurationData).Name,
configurationObject);
}
public override void LoadConfigurationValues(BSE.Configuration.Configuration configuration)
{
if (configuration == null)
{
throw new ArgumentNullException("configuration",
string.Format(System.Globalization.CultureInfo.InvariantCulture,
Resources.IDS_ArgumentNullException,
"configuration"));
}
RenderStyleConfigurationData configurationObject =
GetConfiguration(configuration) as RenderStyleConfigurationData;
if (configurationObject != null)
{
this.m_cboProfessionalColorTable.SelectedValueChanged -= new EventHandler(ColorSchemesSelectedValueChanged);
this.m_cboRenderers.SelectedValueChanged -= new EventHandler(RenderersSelectedValueChanged);
LoadFormStyles(configurationObject);
}
}
public static IConfigurationData GetConfiguration(BSE.Configuration.Configuration configuration)
{
if (configuration == null)
{
throw new ArgumentNullException("configuration",
string.Format(System.Globalization.CultureInfo.InvariantCulture,
Resources.IDS_ArgumentNullException,
"configuration"));
}
return configuration.GetValue(
OptionsConfiguration,
typeof(RenderStyleConfigurationData).Name,
new RenderStyleConfigurationData()) as RenderStyleConfigurationData;
}
#endregion
#region MethodsPrivate
private void LoadFormStyles(RenderStyleConfigurationData configurationObject)
{
RenderStyle renderStyle = configurationObject.RenderStyle;
if (renderStyle != null)
{
if (renderStyle.TypeToolStripProfessionalRenderer != null)
{
this.m_cboRenderers.DataSource = RenderStyles.GetRenderStyles();
this.m_cboRenderers.DisplayMember = "Name";
this.m_cboRenderers.ValueMember = "TypeToolStripProfessionalRenderer";
this.m_cboRenderers.SelectedValue = renderStyle.TypeToolStripProfessionalRenderer;
ToolStripProfessionalRenderer toolStripRenderer =
Activator.CreateInstance(renderStyle.TypeToolStripProfessionalRenderer) as ToolStripProfessionalRenderer;
if (toolStripRenderer != null)
{
Type typeOfClass = toolStripRenderer.ColorTable.GetType().BaseType;
Assembly assembly = toolStripRenderer.ColorTable.GetType().Assembly;
Type[] types = assembly.GetTypes();
foreach (Type colorTableType in types)
{
if ((colorTableType.IsClass == true) &&
(typeOfClass.IsAssignableFrom(colorTableType) == true) &&
(typeOfClass != colorTableType) &&
(typeOfClass.BaseType == typeof(BSE.Windows.Forms.ProfessionalColorTable)))
{
this.m_cboProfessionalColorTable.Items.Add(colorTableType);
}
}
if (renderStyle.TypeProfessionalColorTable == null)
{
Type typeProfessionalColorTable = toolStripRenderer.ColorTable.GetType();
if (typeProfessionalColorTable != null)
{
this.m_cboProfessionalColorTable.SelectedItem = typeProfessionalColorTable;
}
}
else
{
this.m_cboProfessionalColorTable.SelectedItem = renderStyle.TypeProfessionalColorTable;
}
}
this.m_cboProfessionalColorTable.SelectedValueChanged += new EventHandler(ColorSchemesSelectedValueChanged);
this.m_cboRenderers.SelectedValueChanged += new EventHandler(RenderersSelectedValueChanged);
}
}
}
private void RenderersSelectedValueChanged(object sender, EventArgs e)
{
RenderStyle renderStyle = this.m_cboRenderers.SelectedItem as RenderStyle;
if (renderStyle != null)
{
Type rendererType = renderStyle.TypeToolStripProfessionalRenderer;
ToolStripProfessionalRenderer toolStripProfessionalRenderer = Activator.CreateInstance(rendererType) as ToolStripProfessionalRenderer;
if (toolStripProfessionalRenderer != null)
{
this.m_cboProfessionalColorTable.Items.Clear();
Assembly assembly = toolStripProfessionalRenderer.ColorTable.GetType().Assembly;
Type typeOfClass = toolStripProfessionalRenderer.ColorTable.GetType().BaseType;
Type[] types = assembly.GetTypes();
foreach (Type colorTableType in types)
{
if ((colorTableType.IsClass == true) &&
(typeOfClass.IsAssignableFrom(colorTableType) == true) &&
(typeOfClass != colorTableType) &&
(typeOfClass.BaseType == typeof(BSE.Windows.Forms.ProfessionalColorTable)))
{
this.m_cboProfessionalColorTable.Items.Add(colorTableType);
}
}
}
OnConfigChanging(EventArgs.Empty);
}
}
private void ColorSchemesSelectedValueChanged(object sender, EventArgs e)
{
OnConfigChanging(EventArgs.Empty);
}
#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.