private void calculationOptionControl_Changed(object sender, EventArgs e) { if (!_loadingCalculationOptions) { CalculationOptionsBear calcOpts = Character.CalculationOptions as CalculationOptionsBear; calcOpts.TargetLevel = int.Parse(comboBoxTargetLevel.SelectedItem.ToString()); calcOpts.ThreatScale = (float)numericUpDownThreatValue.Value; Character.EnforceMetagemRequirements = checkBoxEnforceMetagemRequirements.Checked; Character.OnItemsChanged(); } }
protected override void LoadCalculationOptions() { _loadingCalculationOptions = true; if (Character.CalculationOptions == null) { Character.CalculationOptions = new CalculationOptionsBear(); } //if (!Character.CalculationOptions.ContainsKey("TargetLevel")) // Character.CalculationOptions["TargetLevel"] = "73"; //if (!Character.CalculationOptions.ContainsKey("ThreatScale")) // Character.CalculationOptions["ThreatScale"] = "1"; //if (!Character.CalculationOptions.ContainsKey("EnforceMetagemRequirements")) // Character.CalculationOptions["EnforceMetagemRequirements"] = "No"; CalculationOptionsBear calcOpts = Character.CalculationOptions as CalculationOptionsBear; comboBoxTargetLevel.SelectedItem = calcOpts.TargetLevel.ToString(); numericUpDownThreatValue.Value = (decimal)calcOpts.ThreatScale; checkBoxEnforceMetagemRequirements.Checked = Character.EnforceMetagemRequirements; switch (numericUpDownThreatValue.Value.ToString()) { case "0": comboBoxThreatValue.SelectedIndex = 0; break; case "10": comboBoxThreatValue.SelectedIndex = 1; break; case "50": comboBoxThreatValue.SelectedIndex = 2; break; case "100": comboBoxThreatValue.SelectedIndex = 3; break; default: comboBoxThreatValue.SelectedIndex = 4; break; } _loadingCalculationOptions = false; }