/// <summary> /// Attempts to re-evaluate the value of a cell from its formula/references. Clears existing /// error state if successful. /// </summary> /// <param name="cell"></param> private void ReEvaluate(ICell cell) { try { cell.ClearError(); cell.ReEvaluate(context); } catch (Exception e) { cell.SetError(e.Message); } }
/// <summary> /// This is called whenever the internal content of a cell changed because of a user action /// (e.g. entering a new value). It will recalculate the output value and propagate the /// calculation through other cells /// </summary> /// <param name="cell"></param> private void CellContentChanged(ICell cell) { try { cell.ClearError(); UpdateReferences(cell); ReEvaluate(cell); } catch (CircularReference e) { cell.SetError(e.Message); ClearReferences(cell); } catch (Exception e) { cell.SetError(e.Message); } StartPropagation(cell); }