public void UpdateEnabledStates() { List <string> currentConflictNames = new List <string>(); foreach (CheckBox checkBox in CheckBoxes.Values) { if (checkBox.IsChecked.GetValueOrDefault(false)) { Buff buff = checkBox.Tag as Buff; foreach (string conflictName in buff.ConflictingBuffs) { if (!string.IsNullOrEmpty(conflictName) && !currentConflictNames.Contains(conflictName)) { currentConflictNames.Add(conflictName); } } } } foreach (CheckBox checkBox in CheckBoxes.Values) { checkBox.IsEnabled = true; //Buff buff = checkBox.Tag as Buff; Buff buff = (Buff)checkBox.Tag; if (string.IsNullOrEmpty(buff.Group)) { if (FindParent.ContainsKey(buff) && !CheckBoxes[FindParent[buff]].IsChecked.GetValueOrDefault(false)) { checkBox.IsEnabled = false; continue; } } if (!checkBox.IsChecked.GetValueOrDefault(false)) { foreach (string buffName in buff.ConflictingBuffs) { if (currentConflictNames.Contains(buffName)) { checkBox.IsEnabled = false; break; } } } } }
public void UpdateEnabledStates() { List <string> currentConflictNames = new List <string>(); foreach (CheckBox checkBox in CheckBoxes.Values) { if (checkBox.IsChecked.GetValueOrDefault(false)) { Buff buff = checkBox.Tag as Buff; foreach (string conflictName in buff.ConflictingBuffs) { if (!string.IsNullOrEmpty(conflictName) && !currentConflictNames.Contains(conflictName)) { currentConflictNames.Add(conflictName); } } } } foreach (CheckBox checkBox in CheckBoxes.Values) { checkBox.IsEnabled = true; //Buff buff = checkBox.Tag as Buff; Buff buff = (Buff)checkBox.Tag; if (Character != null && buff.Name == "Heroic Presence") { if (Character.Race == CharacterRace.Draenei || Character.Faction == CharacterFaction.Horde) { checkBox.IsEnabled = false; continue; } } if (!string.IsNullOrEmpty(buff.Group) && buff.Group == "Profession Buffs") { checkBox.IsEnabled = false; continue; } if (buff.Name.Contains("Mixology") && !character.HasProfession(Profession.Alchemy)) { checkBox.IsEnabled = false; checkBox.Visibility = Visibility.Collapsed; continue; } else if (buff.Name.Contains("Mixology") && character.HasProfession(Profession.Alchemy)) { checkBox.IsEnabled = true; checkBox.Visibility = Visibility.Visible; continue; } if (!string.IsNullOrEmpty(buff.SetName)) { checkBox.IsEnabled = false; continue; } if (string.IsNullOrEmpty(buff.Group)) { if (FindParent.ContainsKey(buff) && !CheckBoxes[FindParent[buff]].IsChecked.GetValueOrDefault(false)) { checkBox.IsEnabled = false; continue; } } if (!checkBox.IsChecked.GetValueOrDefault(false)) { foreach (string buffName in buff.ConflictingBuffs) { if (currentConflictNames.Contains(buffName)) { checkBox.IsEnabled = false; break; } } } } }