コード例 #1
0
ファイル: PLForm.cs プロジェクト: henanMayueyue/MediaPlayer
        private void SaveNewPlaylist()
        {
            Boolean flag = true;

            foreach (String name in MyPlaylists.getPlaylistNames())
            {
                if (name.Equals(PLNTextBox.Text))
                {
                    flag = false;
                }
            }
            if (flag)
            {
                String[] playlists = new String[NewPLlistBox.Items.Count];
                int      i         = 0;
                foreach (String listitem in NewPLlistBox.Items)
                {
                    playlists[i] = listitem;
                    i++;
                }

                MyPlaylists.setPlaylistNames(new String[] { PLNTextBox.Text });
                MyPlaylistData.setPlaylist(PLNTextBox.Text, ANTextBox.Text, playlist);

                MessageBox.Show("Playlist Named: \"" + PLNTextBox.Text + "\" successfully saved");
                NewPLlistBox.Items.Clear();
                PLNTextBox.Clear();
                ANTextBox.Clear();
            }
            else
            {
                MessageBox.Show("Playlist of Name: \"" + PLNTextBox.Text + "\" already exists");
            }
        }
コード例 #2
0
ファイル: PLForm.cs プロジェクト: henanMayueyue/MediaPlayer
        private void Savebtn_Click(object sender, EventArgs e)
        {
            if (PLNTextBox.Text.Equals("") && NewPLlistBox.Items.Count == 0)
            {
                MessageBox.Show("Please suggest any name to playlist and Please add track to playlist");
                return;
            }

            if (PLNTextBox.Text.Equals(""))
            {
                MessageBox.Show("Please suggest any name to playlist");
                return;
            }
            if (ANTextBox.Text.Equals(""))
            {
                MessageBox.Show("Please suggest any author name to playlist");
                return;
            }

            if (NewPLlistBox.Items.Count == 0)
            {
                MessageBox.Show("Please add track to playlist");
                return;
            }

            switch (action)
            {
            case "ADD":
            {
                SaveNewPlaylist();
                break;
            }

            case "SAVE":
            {
                SaveNewPlaylist();
                break;
            }

            case "EDIT":
            {
                if (!playlistName.Equals(PLNTextBox.Text))
                {
                    MyPlaylistData.delete(playlistName);
                    MyPlaylists.delete(playlistName);
                    MyPlaylists.setPlaylistNames(new String[] { PLNTextBox.Text });
                }

                MyPlaylistData.setPlaylist(PLNTextBox.Text, ANTextBox.Text, playlist);

                MessageBox.Show("Playlist Named: \"" + PLNTextBox.Text + "\" successfully edited");
                NewPLlistBox.Items.Clear();
                PLNTextBox.Clear();
                ANTextBox.Clear();
                this.Close();
                break;
            }
            }
            playlist = null;
        }