public SongWindow(SongTextControl textControl, SearchBar searchBar, MusicItemsViewer musicItemViewer) { this.musicItemViewer = musicItemViewer; this.textControl = textControl; this.searchBar = searchBar; this.searchBar.SelectionChanged += ShowSong; this.musicItemViewer.MusicItemClick += ShowSong; }
public MainPage() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; FileManager.Songs.ToList(); FileManager.Artists.ToList(); this.NavigationCacheMode = NavigationCacheMode.Required; SearchBar SearchBar = new SearchBar(SearchControl, ResultSearchControl, SongTextControl, ListArtistsControl); MusicItemsViewer musicItemsViewer = new MusicItemsViewer(ListArtistsControl, SongTextControl, SearchBar); SongWindow songWindow = new SongWindow(SongTextControl, SearchBar, musicItemsViewer); searchBarPanel = SearchBar; songWindowPanel = songWindow; musicItemsViewerPanel = musicItemsViewer; HardwareButtons.BackPressed += back_Click; }
public MusicItemsViewer(ListBox listArtistsControl, SongTextControl songTextControl, SearchBar searchBar) { this.listArtistsControl = listArtistsControl; ObservableCollection<MusicItem> tmpCollection = new ObservableCollection<MusicItem>(); List<Artist> artists = FileManager.Artists.ToList(); List<MusicItem> musicItems = new List<MusicItem>(); foreach (var artist in artists) { musicItems.Add(artist); } foreach (MusicItem musicItem in musicItems) tmpCollection.Add(musicItem); this.listArtistsControl.ItemsSource = tmpCollection; this.songTextControl = songTextControl; this.searchBar = searchBar; searchBar.SelectionChanged += SelectionChanged; searchBar.ArtistChanged += ArtistChanged; listArtistsControl.SelectionChanged += MusicItemChange; }