Exemplo n.º 1
0
        private void MainForm_Load_1(object sender, EventArgs e)
        {
            // create path if does not exists
            string path   = "C:\\AudioBookPlayer_MH";
            bool   exists = System.IO.Directory.Exists(path);

            if (!exists)
            {
                System.IO.Directory.CreateDirectory(path);
            }

            NumberOfPlayLists file = new NumberOfPlayLists();

            listViewNames.Font = font.DefaultFont;

            if (File.Exists(file.Filename))
            {
                file = LoadXML.loadNumberOfPlaylist();
                populate(file);
            }
            else // if it does not exist create it
            {
                saveXML.Savedata(file, file.Filename);
            }
        }
Exemplo n.º 2
0
        private void DeleteButtton_Click(object sender, EventArgs e)
        {
            if (listViewNames.SelectedItems.Count == 1)
            {
                //delete from listview
                int    selectedrow = listViewNames.FocusedItem.Index;
                string filename    = listViewNames.Items[selectedrow].Text;
                listViewNames.Items[selectedrow].Remove();

                //delete from XMl file number of playlists
                NumberOfPlayLists np1 = LoadXML.loadNumberOfPlaylist();
                np1.Delete(selectedrow);
                saveXML.Savedata(np1, np1.Filename);

                // Delete XML file playlist

                if (File.Exists("C:\\AudioBookPlayer_MH\\" + filename))
                {
                    File.Delete("C:\\AudioBookPlayer_MH\\" + filename);
                }

                else
                {
                    MessageBox.Show("could not find " + filename);
                }
            }
        }
Exemplo n.º 3
0
        private void Closed()
        {
            playlist.CurrentTime          = axWindowsMediaPlayer1.Ctlcontrols.currentPosition;
            playlist.PlayListItemselected = listBoxPlayList.SelectedIndex;

            saveXML.Savedata(playlist, "C:\\AudioBookPlayer_MH\\" + filename);

            NumberOfPlayLists savetime = LoadXML.loadNumberOfPlaylist();
            int position = savetime.NamesOfPlayList.IndexOf(filename);

            savetime.CurrentTimeOfPlaylists.Insert(position, axWindowsMediaPlayer1.Ctlcontrols.currentPositionString); // insert new time

            savetime.CurrentTimeOfPlaylists.RemoveAt(position + 1);                                                    // remove old time

            savetime.TempCurrentfilePlayingofAll.Insert(position, (listBoxPlayList.SelectedIndex + 1).ToString());     // insert new selected file

            savetime.TempCurrentfilePlayingofAll.RemoveAt(position + 1);                                               // remove old selected file.

            saveXML.Savedata(savetime, savetime.Filename);
            timer1.Stop();
        }
Exemplo n.º 4
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            FilePlayList savePlaylist = new FilePlayList();

            foreach (string s in addPlayList.Items)
            {
                savePlaylist.PlayList.Add(s);
            }
            savePlaylist.Onlynames();
            savePlaylist.CurrentTime          = 0;
            savePlaylist.PlayListItemselected = addPlayList.SelectedIndex;

            string filename = textBoxName.Text + ".xml";

            savePlaylist.PlayListFile = filename;

            try
            {
                saveXML.Savedata(savePlaylist, "C:\\AudioBookPlayer_MH\\" + filename);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // load file containing the lists of playlist
            NumberOfPlayLists info = LoadXML.loadNumberOfPlaylist();

            info.NamesOfPlayList.Add(filename);
            info.CurrentTimeOfPlaylists.Add("00:00:00");
            info.TempMaxNúmberOfFiles.Add(addPlayList.Items.Count.ToString());
            info.TempCurrentfilePlayingofAll.Add((savePlaylist.PlayListItemselected + 1).ToString());

            saveXML.Savedata(info, info.Filename);

            UpdateAvailable(this, EventArgs.Empty);

            this.Close();
        }
Exemplo n.º 5
0
        void playAudioBook_OnDataAvailable(object sender, EventArgs e)
        {
            NumberOfPlayLists info = LoadXML.loadNumberOfPlaylist();

            populate(info);
        }