diff options
author | emkael <emkael@tlen.pl> | 2017-07-27 14:20:19 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-07-27 14:20:19 +0200 |
commit | 1a6e46fb0a4726093509723a71512868fe6eaa40 (patch) | |
tree | 7d88783d7c3e042acf1d5f544a3ee0f82968848c | |
parent | 79bf7b0fa374e3f92c05dfa5dae34eef83d12a0c (diff) |
Checking required versions on setting checkbox changes
-rw-r--r-- | Aktywator/MainForm.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 5999e4a..039ab72 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -21,6 +21,9 @@ namespace Aktywator private Version BCSVersion; + public static Version requiredBCSVersion; + public static Version requiredFWVersion; + public MainForm() { InitializeComponent(); @@ -69,10 +72,56 @@ namespace Aktywator // cloning Setting List returned from Bws, because we're going to extend it for version tracking purposes this.bwsSettings = new List<Setting>(bws.initSettings()); this.bwsSettings.Add(new Setting("BM2ShowPlayerNames", this.xShowPlayerNames, bws, new Version(2, 0, 0), new Version(1, 3, 1))); + bindSettingChanges(); bws.loadSettings(); this.WindowState = FormWindowState.Normal; } + private void bindSettingChanges() + { + foreach (Setting s in this.bwsSettings) + { + s.field.CheckedChanged += new EventHandler(setting_field_CheckedChanged); + } + } + + void setting_field_CheckedChanged(object sender, EventArgs e) + { + requiredBCSVersion = null; + requiredFWVersion = null; + foreach (Setting s in this.bwsSettings) + { + if (s.field.Checked) + { + if (requiredBCSVersion == null || requiredBCSVersion < s.bcsV) + { + requiredBCSVersion = s.bcsV; + } + if (requiredFWVersion == null || requiredFWVersion < s.fwV) + { + requiredFWVersion = s.fwV; + } + } + } + lRequiredVersion.Text = (requiredBCSVersion != null) ? requiredBCSVersion.ToString() : "--"; + lRequiredFirmware.Text = (requiredFWVersion != null) ? requiredFWVersion.ToString() : "--"; + if (BCSVersion != null) + { + if (requiredBCSVersion > BCSVersion) + { + lDetectedVersion.ForeColor = Color.Red; + } + else + { + lDetectedVersion.ForeColor = Color.Green; + } + } + else + { + lDetectedVersion.ForeColor = Color.Black; + } + } + private string detectBCSVersion() { RegistryKey[] keys = |