Exemple #1
0
 Message DrawItem(MenuItem item, byte index)
 {
     var s = item != null ? item.Text : "";
     return Bordmonitor.ShowText(s ?? String.Empty, BordmonitorFields.Item, index, item != null && item.IsChecked, false);
 }
Exemple #2
0
 void currentScreen_ItemClicked(MenuScreen screen, MenuItem item)
 {
     switch (item.Action)
     {
         case MenuItemAction.GoToScreen:
             Navigate(item.GoToScreen);
             break;
         case MenuItemAction.GoBackScreen:
             NavigateBack();
             break;
         case MenuItemAction.GoHomeScreen:
             NavigateHome();
             break;
     }
 }
Exemple #3
0
 protected void UnsubscribeItem(MenuItem item)
 {
     if (item == null)
     {
         return;
     }
     item.Clicked -= menuItem_Clicked;
     item.Changed -= menuItem_Changed;
 }
Exemple #4
0
 protected void OnItemClicked(MenuItem item)
 {
     var e = ItemClicked;
     if (e != null)
     {
         e(this, item);
     }
 }
Exemple #5
0
 protected void menuItem_Clicked(MenuItem item)
 {
     OnItemClicked(item);
 }
Exemple #6
0
 protected void menuItem_Changed(MenuItem item)
 {
     OnUpdated(MenuScreenUpdateReason.ItemChanged, item);
 }
Exemple #7
0
 public void AddItem(MenuItem menuItem, int index = -1)
 {
     if (index >= MaxItemsCount || index < 0 && ItemsCount == MaxItemsCount)
     {
         Logger.Error("Can't add screen item \"" + menuItem + "\" with index=" + index + ", count=" + ItemsCount);
         index = MaxItemsCount - 1;
     }
     if (index < 0)
     {
         Items.Add(menuItem);
     }
     else
     {
         if (index < Items.Count)
         {
             UnsubscribeItem(Items[index] as MenuItem);
             Items.RemoveAt(index);
         }
         while (index > Items.Count)
         {
             Items.Add(null);
         }
         Items.Insert(index, menuItem);
     }
     menuItem.Changed += menuItem_Changed;
     menuItem.Clicked += menuItem_Clicked;
     OnUpdated(MenuScreenUpdateReason.Refresh);
 }