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 SearchBar(TextBox searchControl, ListBox resultSearchControl, SongTextControl songTextControl, ListBox listArtistsControl) { this.searchControl = searchControl; this.resultSearchControl = resultSearchControl; this.songTextControl = songTextControl; this.listArtistsControl = listArtistsControl; searchControl.TextChanged += searchControl_TextChanged; resultSearchControl.SelectionChanged += ResultSearchControl_SelectionChanged; }
public void RestoreState(AppState state, SongTextControl songTextControl, ListBox listArtistsControl) { listArtistsControl.Visibility = state.ListArtistsControlVisible; songTextControl.Visibility = state.SongTextControlVisible; songTextControl.SetStackPanel(state.SongTextControlStack); ((ObservableCollection<MusicItem>)listArtistsControl.ItemsSource).Clear(); foreach (MusicItem item in state.ListArtistsControlItems) { ((ObservableCollection<MusicItem>)listArtistsControl.ItemsSource).Add(item); } }
public void SaveState(SongTextControl songTextControl, ListBox listArtistsControl) { var state = new AppState { ListArtistsControlItems = new ObservableCollection<MusicItem>(), }; state.ListArtistsControlVisible = listArtistsControl.Visibility; state.SongTextControlVisible = songTextControl.Visibility; state.SongTextControlStack = songTextControl.GetStackPanel(); foreach (MusicItem item in (ObservableCollection<MusicItem>)listArtistsControl.ItemsSource) { state.ListArtistsControlItems.Add(item); } }
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; }