public void Animate(IUpdateInfo update, string field, Dictionary <int, UpdateCell> TextMap) { string oldval = update.GetOldValue(field); string newval = update.GetNewValue(field); int action = 0; try { if (Convert.ToDouble(oldval) > Convert.ToDouble(newval)) { action = -1; } else { action = 1; } } catch (FormatException) { // ignore } foreach (UpdateCell cell in TextMap.Values) { if (action > 0) { cell.AnimateUp(); } else if (action < 0) { cell.AnimateDown(); } else { cell.AnimateSame(); } } }
public void Animate(IUpdateInfo update, string field, Dictionary<int, UpdateCell> TextMap) { string oldval = update.GetOldValue(field); string newval = update.GetNewValue(field); int action = 0; try { if (Convert.ToDouble(oldval) > Convert.ToDouble(newval)) action = -1; else action = 1; } catch (FormatException) { // ignore } foreach (UpdateCell cell in TextMap.Values) { if (action > 0) cell.AnimateUp(); else if (action < 0) cell.AnimateDown(); else cell.AnimateSame(); } }
private string NotifyValue(IUpdateInfo update, string fldName) { string newValue = update.GetNewValue(fldName); string notify = " " + fldName + " = " + (newValue != null ? newValue : "null"); if (update.IsValueChanged(fldName)) { string oldValue = update.GetOldValue(fldName); notify += " (was " + (oldValue != null ? oldValue : "null") + ")"; } return notify; }
private string NotifyValue(IUpdateInfo update, string fldName) { string newValue = update.GetNewValue(fldName); string notify = " " + fldName + " = " + (newValue != null ? newValue : "null"); if (update.IsValueChanged(fldName)) { string oldValue = update.GetOldValue(fldName); notify += " (was " + (oldValue != null ? oldValue : "null") + ")"; } return(notify); }
/// <summary> /// It seems some streams have a 'spin-up' process that can return an all null update /// until the data starts streaming. We were not catching this and null updates were /// sometimes throwing exceptions that were logged and then swallowed by LS. I think /// a better way is to determine if the update is emtpy (null) and simply not fire if so. /// /// Follows is a very simple check /// </summary> /// <param name="update"></param> /// <returns></returns> private static bool IsUpdateNull(IUpdateInfo update) { for (int i = 1; i < update.NumFields + 1; i++) { object value = update.IsValueChanged(i) ? update.GetNewValue(i) : update.GetOldValue(i); if (value != null) { return(false); } } return(true); }
private static string GetCurrentValue(IUpdateInfo updateInfo, int pos) { string value; if (updateInfo.IsValueChanged(pos)) { value = updateInfo.GetNewValue(pos); } else { value = updateInfo.GetOldValue(pos); } return(value); }
private static string GetCurrentValue(IUpdateInfo updateInfo, int pos) { string result; if (updateInfo.IsValueChanged(pos)) { result = updateInfo.GetNewValue(pos); } else { result = updateInfo.GetOldValue(pos); } return(result); }