public override object Evaluate(object[] arguments, ICalcContext context) { int count = 0; CalcReference calcReference = arguments[0] as CalcReference; foreach (IRange srcRange in calcReference.GetRanges()) { object[,] values = srcRange.Value as object[, ]; for (int row = 0; row < srcRange.Rows.Count; row++) { for (int col = 0; col < srcRange.Columns.Count; col++) { if (values[row, col] is double) { double num = (double)values[row, col]; if (num > 70) { count++; } } } } } return(count); }
public override object Evaluate(object[] arguments, ICalcContext context) { double sum = 0d; foreach (var argument in arguments) { foreach (var item in Enumerate(argument)) { if (item is CalcError) { return(item); } if (item is double) { double value = (double)item; if (value >= 500) { sum += (double)item; } } } } return(sum); }
public override object Evaluate(object[] arguments, ICalcContext context) { if (arguments[0] is CalcReference) { IEnumerable <IRange> ranges = (arguments[0] as CalcReference).GetRanges(); foreach (var range in ranges) { return(range.MergeCells); } } return(false); }
public override object Evaluate(object[] arguments, ICalcContext context) { if (arguments[0] is CalcError) { if ((CalcError)arguments[0] != CalcError.None && (CalcError)arguments[0] != CalcError.GettingData) { return(true); } else { return(false); } } return(false); }
/// <summary> /// Performs the necessary actions before the calculation. /// </summary> public void BeginCalculation(ICalcContext calcContext) { try { Monitor.Enter(this); foreach (CalcEngine calcEngine in calcEngines) { calcEngine.BeginCalculation(calcContext); } } catch (Exception ex) { log.WriteError(ex, Locale.IsRussian ? "Ошибка при выполнении действий перед расчётом" : "Error performing actions before the calculation"); } }
public override object Evaluate(object[] arguments, ICalcContext context) { StringBuilder sb = new StringBuilder(); string result = string.Empty; foreach (var argument in arguments) { if (argument is CalcError) { return(argument); } if (argument is string || argument is double) { sb.Append(argument); } } return(sb.ToString()); }
public override object Evaluate(object[] arguments, ICalcContext context) { return((double)arguments[0] + (double)arguments[1]); }
/// <summary> /// Performs the necessary actions after the calculation. /// </summary> public void EndCalculation() { calcContext = null; }
/// <summary> /// Performs the necessary actions before the calculation. /// </summary> public void BeginCalculation(ICalcContext calcContext) { this.calcContext = calcContext; }