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); }
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; } }
protected void UnsubscribeItem(MenuItem item) { if (item == null) { return; } item.Clicked -= menuItem_Clicked; item.Changed -= menuItem_Changed; }
protected void OnItemClicked(MenuItem item) { var e = ItemClicked; if (e != null) { e(this, item); } }
protected void menuItem_Clicked(MenuItem item) { OnItemClicked(item); }
protected void menuItem_Changed(MenuItem item) { OnUpdated(MenuScreenUpdateReason.ItemChanged, item); }
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); }