private void RefreshScreenWithDelay(MenuScreenUpdateReason reason = MenuScreenUpdateReason.Refresh) { CancelRefreshScreenWithDelay(); refreshScreenDelayTimer = new Timer(delegate { UpdateScreen(reason); }, null, refreshScreenDelay, 0); }
protected void OnUpdated(MenuScreenUpdateReason reason, object item = null) { if (updateSuspended) { return; } var e = Updated; if (e != null) { e(this, new MenuScreenUpdateEventArgs(reason, item)); } }
protected void OnUpdateBody(MenuScreenUpdateReason reason) { if (updateSuspended) { return; } var e = UpdateBody; if (e != null) { e(this); } }
private string GetItemString(MenuScreenUpdateReason reason, int maxLength, RefreshHandler refreshCallback) { var showText = GetShownItemString(maxLength, false); if (showText.Length <= maxLength) { return(showText); } var separator = showText.IndexOf(": "); if (separator <= 0 || separator == showText.Length - 2) { return(GetShownItemString(maxLength, true)); } if (showText.Length == maxLength + 1) { return(showText.Substring(0, separator + 1) + showText.Substring(separator + 2)); } if (reason == MenuScreenUpdateReason.Scroll) { if (refreshCallback != null) { refreshCallback(MenuScreenUpdateReason.Refresh); } return(showText.Substring(0, separator + 1)); } else { showText = showText.Substring(separator + 2); if (ShownItem != null && !StringHelpers.IsNullOrEmpty(ShownItem.RadioAbbreviation)) { var len = showText.Length + ShownItem.RadioAbbreviation.Length; if (len < maxLength) { return(ShownItem.RadioAbbreviation + " " + showText); } else if (len == maxLength && (ShownItem.RadioAbbreviation[ShownItem.RadioAbbreviation.Length - 1] == ':' || !showText[0].IsLetterOrNumber())) { return(ShownItem.RadioAbbreviation + showText); } } } return(showText); }
public virtual void UpdateScreen(MenuScreenUpdateReason reason, object item = null) { UpdateScreen(new MenuScreenUpdateEventArgs(reason, item)); }
public MenuScreenUpdateEventArgs(MenuScreenUpdateReason reason, object item = null) { Reason = reason; Item = item; }
protected void RefreshScreenWithDelay(MenuScreenUpdateReason reason = MenuScreenUpdateReason.Refresh) { CancelRefreshScreenWithDelay(); refreshScreenDelayTimer = new Timer(delegate { UpdateScreen(reason); }, null, refreshScreenDelay, 0); }