/// <summary> /// Returns a specified value of the rule if the cell satisfies the condition. /// </summary> /// <param name="evaluator">The evaluator.</param> /// <param name="baseRow">The row index.</param> /// <param name="baseColumn">The column index.</param> /// <param name="actual">The current value.</param> /// <returns>Returns the conditional number value.</returns> public override object Evaluate(ICalcEvaluator evaluator, int baseRow, int baseColumn, IActualValue actual) { this.lastActualValue = actual; object obj2 = actual.GetValue(baseRow, baseColumn); if (obj2 != null) { double num; try { num = ConditionValueConverter.ToDouble(obj2); } catch (InvalidCastException) { return(null); } double?nullable = base.GetActualValue(evaluator, baseRow, baseColumn, 0, actual); double?nullable2 = base.GetActualValue(evaluator, baseRow, baseColumn, 2, actual); if (nullable.HasValue && nullable2.HasValue) { return(ScaleRule.EvaluateColor(ScaleRule.Evaluate2Scale(num, nullable.Value, nullable2.Value), this.MinimumColor, this.MaximumColor)); } } return(null); }
/// <summary> /// Returns the specified value of the rule if the cell meets the condition. /// </summary> /// <param name="evaluator">The evaluator.</param> /// <param name="baseRow">The row index.</param> /// <param name="baseColumn">The column index.</param> /// <param name="actual">The current value.</param> /// <returns>Returns the conditional number value.</returns> public override object Evaluate(ICalcEvaluator evaluator, int baseRow, int baseColumn, IActualValue actual) { this.lastActualValue = actual; object obj2 = actual.GetValue(baseRow, baseColumn); if (obj2 != null) { double num; try { num = ConditionValueConverter.ToDouble(obj2); } catch (InvalidCastException) { return(null); } double?nullable = base.GetActualValue(evaluator, baseRow, baseColumn, 0, actual); double?nullable2 = base.GetActualValue(evaluator, baseRow, baseColumn, 1, actual); double?nullable3 = base.GetActualValue(evaluator, baseRow, baseColumn, 2, actual); if ((nullable.HasValue && nullable3.HasValue) && nullable2.HasValue) { double?nullable4 = nullable; double?nullable5 = nullable3; if ((((double)nullable4.GetValueOrDefault()) > ((double)nullable5.GetValueOrDefault())) && (nullable4.HasValue & nullable5.HasValue)) { return(null); } double num4 = num; double?nullable6 = nullable; if ((num4 < ((double)nullable6.GetValueOrDefault())) && nullable6.HasValue) { return(this.MinimumColor); } double num5 = num; double?nullable7 = nullable3; if ((num5 >= ((double)nullable7.GetValueOrDefault())) && nullable7.HasValue) { return(this.MaximumColor); } if ((nullable.Value <= num) && (num <= nullable2.Value)) { return(ScaleRule.EvaluateColor(ScaleRule.Evaluate2Scale(num, nullable.Value, nullable2.Value), this.MinimumColor, this.MidpointColor)); } return(ScaleRule.EvaluateColor(ScaleRule.Evaluate2Scale(num, nullable2.Value, nullable3.Value), this.MidpointColor, this.MaximumColor)); } } return(null); }