public static bool ProcessMatrixAttributeComboBoxChange(this IHasMatrixAttributes objThis, Character objCharacter, ElasticComboBox cboChangedAttribute, ElasticComboBox cboAttack, ElasticComboBox cboSleaze, ElasticComboBox cboDataProcessing, ElasticComboBox cboFirewall) { if (objThis == null) { return(false); } if (objCharacter == null) { throw new ArgumentNullException(nameof(objCharacter)); } if (cboChangedAttribute == null) { throw new ArgumentNullException(nameof(cboChangedAttribute)); } if (cboAttack == null) { throw new ArgumentNullException(nameof(cboAttack)); } if (cboSleaze == null) { throw new ArgumentNullException(nameof(cboSleaze)); } if (cboDataProcessing == null) { throw new ArgumentNullException(nameof(cboDataProcessing)); } if (cboFirewall == null) { throw new ArgumentNullException(nameof(cboFirewall)); } string strTemp; Action <string> funcAttributePropertySetter; if (cboChangedAttribute == cboAttack) { strTemp = objThis.Attack; funcAttributePropertySetter = (x => objThis.Attack = x); } else if (cboChangedAttribute == cboSleaze) { strTemp = objThis.Sleaze; funcAttributePropertySetter = (x => objThis.Sleaze = x); } else if (cboChangedAttribute == cboDataProcessing) { strTemp = objThis.DataProcessing; funcAttributePropertySetter = (x => objThis.DataProcessing = x); } else if (cboChangedAttribute == cboFirewall) { strTemp = objThis.Firewall; funcAttributePropertySetter = (x => objThis.Firewall = x); } else { return(false); } int intCurrentIndex = cboChangedAttribute.DoThreadSafeFunc(x => x.SelectedIndex); bool blnRefreshCharacter = false; bool blnDPChanged = cboChangedAttribute == cboDataProcessing; // Find the combo with the same value as this one and change it to the missing value. if (cboChangedAttribute != cboAttack && cboAttack.DoThreadSafeFunc(x => x.SelectedIndex) == intCurrentIndex) { funcAttributePropertySetter.Invoke(objThis.Attack); objThis.Attack = strTemp; blnRefreshCharacter = true; } else if (cboChangedAttribute != cboSleaze && cboSleaze.DoThreadSafeFunc(x => x.SelectedIndex) == intCurrentIndex) { funcAttributePropertySetter.Invoke(objThis.Sleaze); objThis.Sleaze = strTemp; blnRefreshCharacter = true; } else if (!blnDPChanged && cboDataProcessing.DoThreadSafeFunc(x => x.SelectedIndex) == intCurrentIndex) { funcAttributePropertySetter.Invoke(objThis.DataProcessing); objThis.DataProcessing = strTemp; blnRefreshCharacter = true; blnDPChanged = true; } else if (cboChangedAttribute != cboFirewall && cboFirewall.DoThreadSafeFunc(x => x.SelectedIndex) == intCurrentIndex) { funcAttributePropertySetter.Invoke(objThis.Firewall); objThis.Firewall = strTemp; blnRefreshCharacter = true; } if (blnRefreshCharacter) { objThis.RefreshMatrixAttributeComboBoxes(cboAttack, cboSleaze, cboDataProcessing, cboFirewall); if (objThis.IsActiveCommlink(objCharacter) || objThis.IsHomeNode(objCharacter)) { if (blnDPChanged) { if (objThis.IsActiveCommlink(objCharacter)) { if (objThis.IsHomeNode(objCharacter)) { objCharacter.OnMultiplePropertyChanged(nameof(Character.MatrixInitiativeValue), nameof(Character.MatrixInitiativeColdValue), nameof(Character.MatrixInitiativeHotValue)); } else { objCharacter.OnMultiplePropertyChanged(nameof(Character.MatrixInitiativeColdValue), nameof(Character.MatrixInitiativeHotValue)); } } else { objCharacter.OnPropertyChanged(nameof(Character.MatrixInitiativeValue)); } } return(true); } } return(false); }