protected void SetContactsScreenItems() { if (offset < 0) { offset = 0; } var contacts = GetContacts((uint)offset, (uint)contactsPerPage); if (contacts.Count == 0 && offset > 0) { offset = 0; SetContactsScreenItems(); return; } contactsScreen.IsUpdateSuspended = true; var i = 2; if (contacts.Count == 0) { contactsScreen.AddItem(new MenuItem(mi => Localization.Current.NoContacts), i++); } else { foreach (var c in contacts) { var contact = (PhoneContact)c; contactsScreen.AddItem(new MenuItem(contact.Name, it => CallPhone(contact.Phones)), i++); // TODO show phones } // TODO clear empty items (if any) } contactsScreen.IsUpdateSuspended = false; contactsScreen.Refresh(); }
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; }
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(); }