예제 #1
0
        public SongUpdate PromptSongData(InfoType infoType)
        {
            Song song;

            if (songBox.SelectedItem != null)
            {
                song = songBox.SelectedItem as Song;
            }
            else if (artistBox.SelectedItem != null)
            {
                song = CreateSongDataFromAlbumAndArtist();
            }
            else
            {
                return(null);
            }

            if (infoType == InfoType.Song)
            {
                if (song.Album == "<unknown>" || song.Artist == "<unknown>")
                {
                    song = PopulateSongDataFromTags(song);
                }
            }


            var dialog = new InfoWindow(new SongUpdate(song), infoType);

            var result = dialog.ShowDialog();

            if (result == true)
            {
                return(dialog.SongData);
            }

            return(null);
        }
예제 #2
0
        public SongUpdate PromptSongData(InfoType infoType)
        {
            Song song;

            if (infoType == InfoType.Album && viewModel.SelectedAlbum != Song.ALL_ALBUMS)
            {
                var artist = viewModel.SelectedArtist != Song.ALL_ARTISTS ? viewModel.SelectedArtist : null;
                if (artist == null && viewModel.Songs.Count > 0)
                {
                    artist = viewModel.Songs[0].Artist;
                }
                Messenger.Log("Editing album");
                song = new Song(artist, viewModel.SelectedAlbum, null);
                var infoWindow = new InfoWindow(new SongUpdate(song), infoType);
                var useData    = infoWindow.ShowDialog();
                return(useData == true ? infoWindow.SongData : null);
            }

            if (infoType == InfoType.Artist && viewModel.SelectedArtist != Song.ALL_ARTISTS)
            {
                Messenger.Log("Editing artist");
                song = new Song(viewModel.SelectedArtist, null, null);
                var infoWindow = new InfoWindow(new SongUpdate(song), infoType);
                var useData    = infoWindow.ShowDialog();
                return(useData == true ? infoWindow.SongData : null);
            }

            if (songBox.SelectedItem != null)
            {
                song = songBox.SelectedItem as Song;
            }
            else if (artistBox.SelectedItem != null)
            {
                if (artistBox.SelectedItem?.ToString() == Song.ALL_ARTISTS ||
                    albumBox.SelectedItem?.ToString() == Song.ALL_ALBUMS)
                {
                    return(null);
                }

                song = CreateSongDataFromAlbumAndArtist();
            }
            else
            {
                song = null;
            }

            if (song == null)
            {
                Messenger.Log("Song not found?");
                return(null);
            }

            if (infoType == InfoType.Song)
            {
                if (song.Album == "<unknown>" || song.Artist == "<unknown>")
                {
                    song = PopulateSongDataFromTags(song);
                }
            }

            var dialog = new InfoWindow(new SongUpdate(song), infoType);

            var result = dialog.ShowDialog();

            return(result == true ? dialog.SongData : null);
        }