示例#1
0
        private void AddCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            Console.WriteLine("Adding song");

            Song song = new Song
            {
                Title    = titleTextBox.Text,
                Artist   = artistTextBox.Text,
                Album    = albumTextBox.Text,
                Filename = filenameTextBox.Text,
                Length   = lengthTextBox.Text,
                Genre    = genreTextBox.Text
            };

            musicLib.AddSong(song);

            // Now that the id has been set, add it songIds, which automatically adds to the combo box
            songIdComboBox.IsEnabled = true;
            string id = song.Id.ToString();

            songIds.Add(id);
            songIdComboBox.SelectedIndex = songIdComboBox.Items.Count - 1;

            // There is at least one song that can be deleted
            deleteButton.IsEnabled = true;
        }
示例#2
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            // Add the selected file to the music library
            Song s = new Song
            {
                Title    = titleTextBox.Text,
                Artist   = artistTextBox.Text,
                Album    = albumTextBox.Text,
                Genre    = genreTextBox.Text,
                Length   = lengthTextBox.Text,
                Filename = filenameTextBox.Text
            };
            string id = musicLib.AddSong(s).ToString();

            // Add the song ID to the combo box
            songIdComboBox.IsEnabled = true;
            (songIdComboBox.ItemsSource as ObservableCollection <string>).Add(id);
            songIdComboBox.SelectedIndex = songIdComboBox.Items.Count - 1;
        }
        private void AddCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            Console.WriteLine("Adding song");

            // Add the selected file to the music library
            Song song = new Song
            {
                Title    = titleTextBox.Text,
                Artist   = artistTextBox.Text,
                Album    = albumTextBox.Text,
                Genre    = genreTextBox.Text,
                Length   = lengthTextBox.Text,
                Filename = filenameTextBox.Text
            };
            string id = musicLib.AddSong(song).ToString();

            // Add the song ID to the combo box
            songIdComboBox.IsEnabled = true;
            (songIdComboBox.ItemsSource as ObservableCollection <string>).Add(id);
            songIdComboBox.SelectedIndex = songIdComboBox.Items.Count - 1;
            // There is at least one song that can be deleted
            deleteButton.IsEnabled = true;
        }