public MainForm(String[] file)
        {
            InitializeComponent();
            playlist = MediaPlayerControl.playlistCollection.newPlaylist("MyPlayList");
            MediaPlayerControl.currentPlaylist = playlist;

            NPlist = null;

            MyPlaylists    = playlists.getInstance();
            MyPlaylistData = PlaylistData.getInstance();
            if (MyPlaylists.getPlaylistNames() != null)
            {
                foreach (String filename in MyPlaylists.getPlaylistNames())
                {
                    PLlistBox.Items.Add(filename);
                }
            }
            if (file.Length > 0)
            {
                NPlist = file;
                foreach (String listItem in file)
                {
                    string value = listItem.Substring(listItem.LastIndexOf("\\") + 1);
                    value = "    " + value;
                    NPlistbox.Items.Add(value);
                    media = MediaPlayerControl.newMedia(listItem);
                    playlist.appendItem(media);
                }
                MediaPlayerControl.Ctlcontrols.play();
                NPlistbox.SelectedIndex = 0;
            }
        }
Exemple #2
0
 public static playlists getInstance()
 {
     if (PlaylistObject == null)
     {
         PlaylistObject = new playlists();
     }
     return(PlaylistObject);
 }
Exemple #3
0
        public PLForm(String playlistName, String action)
        {
            InitializeComponent();
            MyPlaylistData = PlaylistData.getInstance();
            MyPlaylists    = playlists.getInstance();
            playlist       = null;
            this.action    = action;
            if (this.action.Equals("EDIT"))
            {
                this.playlistName = playlistName;
                PLNTextBox.Text   = playlistName;
                Boolean firstLoopTurn = true;
                foreach (String listitem in MyPlaylistData.getPlaylist(playlistName))
                {
                    if (firstLoopTurn)
                    {
                        ANTextBox.Text = listitem;
                        firstLoopTurn  = false;
                        continue;
                    }
                    NewPLlistBox.Items.Add(listitem.Substring(listitem.LastIndexOf("\\") + 1));
                }

                playlist = new String[NewPLlistBox.Items.Count];
                int i = 0;
                firstLoopTurn = true;
                foreach (String listitem in MyPlaylistData.getPlaylist(playlistName))
                {
                    if (firstLoopTurn)
                    {
                        ANTextBox.Text = listitem;
                        firstLoopTurn  = false;
                        continue;
                    }
                    playlist[i] = listitem;
                    i++;
                }
            }
            else if (this.action.Equals("SAVE"))
            {
                int i = 0;
                playlist = new String[MainForm.NPlist.Length];
                foreach (String listitem in MainForm.NPlist)
                {
                    playlist[i] = listitem;
                    NewPLlistBox.Items.Add(listitem.Substring(listitem.LastIndexOf("\\") + 1));
                    i++;
                }
            }
        }