Exemple #1
0
 private void RefreshScreenWithDelay(MenuScreenUpdateReason reason = MenuScreenUpdateReason.Refresh)
 {
     CancelRefreshScreenWithDelay();
     refreshScreenDelayTimer = new Timer(delegate
     {
         UpdateScreen(reason);
     }, null, refreshScreenDelay, 0);
 }
Exemple #2
0
        protected void OnUpdated(MenuScreenUpdateReason reason, object item = null)
        {
            if (updateSuspended)
            {
                return;
            }
            var e = Updated;

            if (e != null)
            {
                e(this, new MenuScreenUpdateEventArgs(reason, item));
            }
        }
Exemple #3
0
        protected void OnUpdateBody(MenuScreenUpdateReason reason)
        {
            if (updateSuspended)
            {
                return;
            }
            var e = UpdateBody;

            if (e != null)
            {
                e(this);
            }
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 public virtual void UpdateScreen(MenuScreenUpdateReason reason, object item = null)
 {
     UpdateScreen(new MenuScreenUpdateEventArgs(reason, item));
 }
Exemple #6
0
 public MenuScreenUpdateEventArgs(MenuScreenUpdateReason reason, object item = null)
 {
     Reason = reason;
     Item   = item;
 }
Exemple #7
0
 protected void RefreshScreenWithDelay(MenuScreenUpdateReason reason = MenuScreenUpdateReason.Refresh)
 {
     CancelRefreshScreenWithDelay();
     refreshScreenDelayTimer = new Timer(delegate
     {
         UpdateScreen(reason);
     }, null, refreshScreenDelay, 0);
 }
Exemple #8
0
 public virtual void UpdateScreen(MenuScreenUpdateReason reason, object item = null)
 {
     UpdateScreen(new MenuScreenUpdateEventArgs(reason, item));
 }
Exemple #9
0
 public MenuScreenUpdateEventArgs(MenuScreenUpdateReason reason, object item = null)
 {
     Reason = reason;
     Item = item;
 }
Exemple #10
0
 protected void OnUpdated(MenuScreenUpdateReason reason, object item = null)
 {
     if (updateSuspended)
     {
         return;
     }
     var e = Updated;
     if (e != null)
     {
         e(this, new MenuScreenUpdateEventArgs(reason, item));
     }
 }