Skip to content

Commit

Permalink
#47 Allow User to select Krypton Theme
Browse files Browse the repository at this point in the history
- Add new form
- Wire up events to performs immediate redraw
  • Loading branch information
Smurf-IV committed Feb 17, 2019
1 parent 376c56b commit c475f52
Show file tree
Hide file tree
Showing 8 changed files with 2,232 additions and 4 deletions.
11 changes: 10 additions & 1 deletion Elucidate/Elucidate/Elucidate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</AssemblyInfoVersionSettings>
<PrimaryVersionType>AssemblyVersionAttribute</PrimaryVersionType>
<AssemblyInfoFilePath>Properties\AssemblyInfo.cs</AssemblyInfoFilePath>
<AssemblyVersion>19.2.948.17</AssemblyVersion>
<AssemblyVersion>19.2.952.17</AssemblyVersion>
<UpdatePackageVersion>False</UpdatePackageVersion>
<AssemblyInfoVersionType>SettingsVersion</AssemblyInfoVersionType>
<InheritWinAppVersionFrom>None</InheritWinAppVersionFrom>
Expand Down Expand Up @@ -131,6 +131,12 @@
<Compile Include="ExtendedToolkit\KryptonCommandLinkButtonDesigner.cs" />
<Compile Include="ExtendedToolkit\KryptonCommandLinkVersion1.cs" />
<Compile Include="ExtendedToolkit\ViewDrawCommandLinkButton.cs" />
<Compile Include="Forms\ThemeSelector.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\ThemeSelector.designer.cs">
<DependentUpon>ThemeSelector.cs</DependentUpon>
</Compile>
<Compile Include="HelperClasses\AdvancedSettingsHelper.cs" />
<Compile Include="CmdLine\CheckVerb.cs" />
<Compile Include="CmdLine\DiffVerb.cs" />
Expand Down Expand Up @@ -223,6 +229,9 @@
<EmbeddedResource Include="Controls\LiveRunLogControl.resx">
<DependentUpon>LiveRunLogControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ThemeSelector.resx">
<DependentUpon>ThemeSelector.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="TabPages\CommonTab.resx">
<DependentUpon>CommonTab.cs</DependentUpon>
</EmbeddedResource>
Expand Down
15 changes: 14 additions & 1 deletion Elucidate/Elucidate/Forms/ElucidateForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Elucidate/Elucidate/Forms/ElucidateForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ public ElucidateForm()
Properties.Settings.Default.Save();
}
WindowLocation.GeometryFromString(Properties.Settings.Default.WindowLocation, this);
if (Enum.TryParse(Properties.Settings.Default.Theme, out PaletteModeManager value))
{
RecalcNonClient();
kryptonManager1.GlobalPaletteMode = value;
}

// Hook into changes in the global palette
KryptonManager.GlobalPaletteChanged += OnPaletteChanged;

}

private void ElucidateForm_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -239,6 +248,15 @@ private void showMeTheLatestReleaseStatsToolStripMenuItem_Click(object sender, E
}
#endregion Menu Handlers

private void OnPaletteChanged(object sender, EventArgs e)
{
// persist our geometry string.
RecalcNonClient();
Properties.Settings.Default.Theme = kryptonManager1.GlobalPaletteMode.ToString();
Properties.Settings.Default.Save();
}


private void ElucidateForm_ResizeEnd(object sender, EventArgs e)
{
// persist our geometry string.
Expand Down Expand Up @@ -326,5 +344,13 @@ private void tabControl_SelectedPageChanged(object sender, EventArgs e)
}
Log.Trace("tabControl_SelectedPageChanged - OUT");
}

private void changeTheThemeToolStripMenuItem_Click(object sender, EventArgs e)
{
using (ThemeSelector ts = new ThemeSelector())
{
ts.ShowDialog(this);
}
}
}
}
3 changes: 3 additions & 0 deletions Elucidate/Elucidate/Forms/ElucidateForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="kryptonManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>229, 15</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>57</value>
</metadata>
Expand Down
182 changes: 182 additions & 0 deletions Elucidate/Elucidate/Forms/ThemeSelector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
// *****************************************************************************
//
// © Component Factory Pty Ltd 2012 - 2019 - 2019. All rights reserved.
// The software and associated documentation supplied hereunder are the
// proprietary information of Component Factory Pty Ltd, PO Box 1504,
// Glen Waverley, Vic 3150, Australia and are supplied subject to licence terms.
//
// Version 5.470.0.0 www.ComponentFactory.com
// *****************************************************************************

using System;
using ComponentFactory.Krypton.Toolkit;

namespace Elucidate.Forms
{
public partial class ThemeSelector : KryptonForm
{
public ThemeSelector()
{
InitializeComponent();
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
// Remember to unhook from static event, otherwise
// this object cannot be garbage collected later on
KryptonManager.GlobalPaletteChanged -= OnPaletteChanged;

if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}

private void Form2_Load(object sender, EventArgs e)
{
// Set correct initial radio button setting
UpdateRadioButtons();

// Hook into changes in the global palette
KryptonManager.GlobalPaletteChanged += OnPaletteChanged;
}

private void radio2010Blue_CheckedChanged(object sender, EventArgs e)
{
if (radio2010Blue.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2010Blue;
}
}

private void radio2010Silver_CheckedChanged(object sender, EventArgs e)
{
if (radio2010Silver.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2010Silver;
}
}

private void radio2010Black_CheckedChanged(object sender, EventArgs e)
{
if (radio2010Black.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2010Black;
}
}

private void radio2007Blue_CheckedChanged(object sender, EventArgs e)
{
if (radio2007Blue.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2007Blue;
}
}

private void radio2007Silver_CheckedChanged(object sender, EventArgs e)
{
if (radio2007Silver.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2007Silver;
}
}

private void radio2007Black_CheckedChanged(object sender, EventArgs e)
{
if (radio2007Black.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2007Black;
}
}

private void radioSparkleBlue_CheckedChanged(object sender, EventArgs e)
{
if (radioSparkleBlue.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.SparkleBlue;
}
}

private void radioSparkleOrange_CheckedChanged(object sender, EventArgs e)
{
if (radioSparkleOrange.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.SparkleOrange;
}
}

private void radioSparklePurple_CheckedChanged(object sender, EventArgs e)
{
if (radioSparklePurple.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.SparklePurple;
}
}

private void radioOffice2003_CheckedChanged(object sender, EventArgs e)
{
if (radioOffice2003.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.ProfessionalOffice2003;
}
}

private void radioSystem_CheckedChanged(object sender, EventArgs e)
{
if (radioSystem.Checked)
{
kryptonManager.GlobalPaletteMode = PaletteModeManager.ProfessionalSystem;
}
}

private void OnPaletteChanged(object sender, EventArgs e)
{
// Update buttons to reflect the new palette setting
UpdateRadioButtons();
}

private void UpdateRadioButtons()
{
switch (kryptonManager.GlobalPaletteMode)
{
case PaletteModeManager.Office2010Blue:
radio2010Blue.Checked = true;
break;
case PaletteModeManager.Office2010Silver:
radio2010Silver.Checked = true;
break;
case PaletteModeManager.Office2010Black:
radio2010Black.Checked = true;
break;
case PaletteModeManager.Office2007Blue:
radio2007Blue.Checked = true;
break;
case PaletteModeManager.Office2007Silver:
radio2007Silver.Checked = true;
break;
case PaletteModeManager.Office2007Black:
radio2007Black.Checked = true;
break;
case PaletteModeManager.SparkleBlue:
radioSparkleBlue.Checked = true;
break;
case PaletteModeManager.SparkleOrange:
radioSparkleOrange.Checked = true;
break;
case PaletteModeManager.SparklePurple:
radioSparklePurple.Checked = true;
break;
case PaletteModeManager.ProfessionalOffice2003:
radioOffice2003.Checked = true;
break;
case PaletteModeManager.ProfessionalSystem:
radioSystem.Checked = true;
break;
}
}
}
}
Loading

0 comments on commit c475f52

Please sign in to comment.