public AddItem ( |
||
menuItem | ||
index | int | |
Результат | void |
protected MenuScreen CreatePhoneScreen() { var screen = new MenuScreen(Name); screen.AddItem(new MenuItem(i => Localization.Current.VoiceCall, i => SendCommand(CmdVoiceCall))); screen.AddItem(new MenuItem(i => Localization.Current.Contacts, MenuItemType.Button, MenuItemAction.GoToScreen) { GoToScreen = CreateContactsScreen() }); screen.AddBackButton(); return screen; }
public static void AddBackButton(this MenuScreen screen, int index = -1) { screen.AddItem(new MenuItem(i => "« " + Localization.Current.Back, MenuItemType.Button, MenuItemAction.GoBackScreen), index); }
protected MenuScreen CreateContactsScreen() { contactsPerPage = MenuScreen.MaxItemsCount - 3; contactsScreen = new MenuScreen(s => Localization.Current.Contacts); contactsScreen.AddItem(new MenuItem(i => "< " + Localization.Current.PrevItems, i => { offset -= contactsPerPage; SetContactsScreenItems(); }), 0); // TODO navigate contactsScreen.AddItem(new MenuItem(i => Localization.Current.NextItems + " >", i => { offset += contactsPerPage; SetContactsScreenItems(); }), 1); // TODO test, fix and make 1 contactsScreen.AddBackButton(MenuScreen.MaxItemsCount - 1); contactsScreen.NavigatedTo += s => { offset = 0; // TODO don't scroll on navigate back SetContactsScreenItems(); }; return contactsScreen; }
void UpdateNowPlayingScreen(MenuScreen nowPlayingScreen, TrackInfo nowPlaying) { nowPlayingScreen.IsUpdateSuspended = true; nowPlayingScreen.Status = nowPlaying.GetTrackPlaylistPosition(); nowPlayingScreen.ClearItems(); if (NowPlayingTagsSeparatedRows) { if (!StringHelpers.IsNullOrEmpty(nowPlaying.Title)) { nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.Title)); } if (!StringHelpers.IsNullOrEmpty(nowPlaying.Artist)) { nowPlayingScreen.AddItem(new MenuItem(i => CharIcons.BordmonitorBull + " " + Localization.Current.Artist + ":")); nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.Artist)); } if (!StringHelpers.IsNullOrEmpty(nowPlaying.Album)) { nowPlayingScreen.AddItem(new MenuItem(i => CharIcons.BordmonitorBull + " " + Localization.Current.Album + ":")); nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.Album)); } if (!StringHelpers.IsNullOrEmpty(nowPlaying.Genre)) { nowPlayingScreen.AddItem(new MenuItem(i => CharIcons.BordmonitorBull + " " + Localization.Current.Genre + ":")); nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.Genre)); } } else { if (!StringHelpers.IsNullOrEmpty(nowPlaying.Title)) { nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.GetTitleWithLabel())); } if (!StringHelpers.IsNullOrEmpty(nowPlaying.Artist)) { nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.GetArtistWithLabel())); } if (!StringHelpers.IsNullOrEmpty(nowPlaying.Album)) { nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.GetAlbumWithLabel())); } if (!StringHelpers.IsNullOrEmpty(nowPlaying.Genre)) { nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.GetGenreWithLabel())); } } nowPlayingScreen.AddBackButton(); nowPlayingScreen.IsUpdateSuspended = false; nowPlayingScreen.Refresh(); }