Allow hidden settings to be displayed

hold control
This commit is contained in:
Kurt 2019-01-27 21:57:26 -08:00
parent 6353e8d84d
commit 3b8dc42f1a
5 changed files with 27 additions and 3 deletions

View file

@ -67,6 +67,9 @@
<setting name="AllowGen1Tradeback" serializeAs="String">
<value>True</value>
</setting>
<setting name="HaX" serializeAs="String">
<value>False</value>
</setting>
</PKHeX.WinForms.Properties.Settings>
</userSettings>
<runtime>

View file

@ -117,6 +117,7 @@ namespace PKHeX.WinForms
{
ConfigUtil.CheckConfig();
FormLoadConfig(out BAKprompt, out showChangelog);
HaX |= Settings.Default.HaX;
}
catch (ConfigurationErrorsException e)
{
@ -395,7 +396,7 @@ namespace PKHeX.WinForms
{
var settings = Settings.Default;
var ver = settings.DefaultSaveVersion; // check if it changes
new SettingsEditor(settings, nameof(settings.BAKPrompt)).ShowDialog();
new SettingsEditor(settings, nameof(settings.BAKPrompt), nameof(settings.HaX)).ShowDialog();
// Reload text (if OT details hidden)
Text = GetProgramTitle(C_SAV.SAV);

View file

@ -262,5 +262,17 @@ namespace PKHeX.WinForms.Properties {
this["AllowGen1Tradeback"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool HaX {
get {
return ((bool)(this["HaX"]));
}
set {
this["HaX"] = value;
}
}
}
}

View file

@ -62,5 +62,8 @@
<Setting Name="AllowGen1Tradeback" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="HaX" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
@ -42,10 +43,12 @@ namespace PKHeX.WinForms
private readonly object SettingsObject;
private void LoadSettings(IEnumerable<string> blacklist)
private void LoadSettings(IReadOnlyList<string> blacklist)
{
var type = SettingsObject.GetType();
var props = ReflectUtil.GetPropertiesCanWritePublicDeclared(type).Except(blacklist);
var props = ReflectUtil.GetPropertiesCanWritePublicDeclared(type);
if (ModifierKeys != Keys.Control)
props = props.Except(blacklist);
foreach (var p in props)
{
var state = ReflectUtil.GetValue(Settings.Default, p);
@ -55,6 +58,8 @@ namespace PKHeX.WinForms
var chk = GetCheckBox(p, b);
FLP_Settings.Controls.Add(chk);
FLP_Settings.SetFlowBreak(chk, true);
if (blacklist.Contains(p))
chk.ForeColor = Color.Red;
continue;
}
}