Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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;
        }