예제 #1
0
        private void addToNowPlaying()
        {
            string selItem = null;

            NPlist = null;
            try
            {
                String[] tempList = new String[NPlistbox.Items.Count];
                int      i        = 0;
                int      count    = playlist.count;

                for (int j = 0; j < count; j++)
                {
                    playlist.removeItem(playlist.get_Item(0));
                }

                NPlistbox.Items.Clear();

                selItem = PLlistBox.SelectedItem.ToString();
                Boolean firstLoopTurn = false;
                foreach (String listItem in MyPlaylistData.getPlaylist(selItem))
                {
                    if (firstLoopTurn)
                    {
                        string value = listItem.Substring(listItem.LastIndexOf("\\") + 1);
                        value = "    " + value;
                        NPlistbox.Items.Add(value);

                        media = MediaPlayerControl.newMedia(listItem);
                        playlist.appendItem(media);
                    }
                    firstLoopTurn = true;
                }

                NPlist        = new String[MyPlaylistData.getPlaylist(selItem).Length - 1];
                i             = 0;
                firstLoopTurn = true;
                foreach (String listitem in MyPlaylistData.getPlaylist(selItem))
                {
                    if (firstLoopTurn)
                    {
                        firstLoopTurn = false;
                        continue;
                    }
                    NPlist[i] = listitem;
                    i++;
                }

                MediaPlayerControl.Ctlcontrols.play();
                tabControl1.SelectedTab = tabPage1;
                NPlistbox.SelectedIndex = 0;
            }

            catch (Exception ex)
            {
                MessageBox.Show("Unable to Play!\n\n" + ex.Message);
            }
        }
예제 #2
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++;
                }
            }
        }