コード例 #1
0
        private void btnSettings_Click(object sender, EventArgs e)
        {
            SettingsForm settingsForm = new SettingsForm();

            settingsForm.Show();
        }
コード例 #2
0
        private void SelectSong()
        {
            OpenFileDialog Open = new OpenFileDialog
            {
                Filter           = "MP3 Files|*.mp3|CSV Files|*.csv" /*+ "|All Files|*.*"*/,
                InitialDirectory = SettingsForm.Path(),
                Multiselect      = true
            };


            if (Open.ShowDialog() == DialogResult.OK)
            {
                if (Path.GetExtension(Open.FileName) == ".csv")
                {
                    if (CSV.Import(Open.FileName, ',').ElementAt(0).Length != 1)
                    {
                        _state = PlayState.CSVPlaylist;

                        PlaylistPath        = Open.FileName;
                        GlobalPath          = Path.GetDirectoryName(PlaylistPath) + "\\";
                        OriginalSongDetails = Songs(PlaylistPath);            //Take full path to .csv and return values
                        SongDetails         = new List <string[]>(OriginalSongDetails);
                        OriginalMusic       = new List <string>(Filenames()); //List of direct paths to each song
                        Music = new List <string>(OriginalMusic);


                        CurrentSong = 0;
                        _songCount  = Music.Count();
                        string firstSong = Music[CurrentSong]; //Artist - Album.mp3


                        _choose.URL = firstSong;
                        SetDetails(CurrentSong);
                        _choose.controls.stop();

                        lblDuration.Text = _choose.currentMedia.durationString;

                        InitializeDefaultSettings();
                    }
                    else if (CSV.Import(Open.FileName, ',').ElementAt(0).Length == 1) // NOT TESTED
                    {
                        _state = PlayState.CSVFilePlaylist;

                        SongDetails = null;
                        GlobalPath  = null;
                        List <string[]> vs = CSV.Import(Open.FileName, ',');

                        OriginalMusic = new List <string>();
                        foreach (var item in vs)
                        {
                            OriginalMusic.Add(item[0]);
                        }
                        Music = new List <string>(OriginalMusic);


                        CurrentSong = 0;
                        _choose.URL = OriginalMusic.ElementAt(0);
                        SetDetails(OriginalMusic.ElementAt(0));

                        _choose.controls.stop();

                        lblDuration.Text = _choose.currentMedia.durationString;

                        InitializeDefaultSettings();
                    }
                }
                else //.mp3
                {
                    if (Open.FileNames.Length == 1)
                    {
                        _state      = PlayState.OneSong;
                        SongDetails = null;

                        GlobalPath    = Path.GetDirectoryName(Open.FileName) + "\\";
                        OriginalMusic = new List <string>(Open.FileNames);
                        Music         = new List <string>(OriginalMusic);

                        CurrentSong = 0;
                        _choose.URL = Open.FileName;
                        SetDetails(Open.FileName);

                        _choose.controls.stop();

                        lblDuration.Text = _choose.currentMedia.durationString;

                        InitializeDefaultSettings();
                    }
                    else
                    {
                        _state      = PlayState.MultipleSongs;
                        SongDetails = null;

                        GlobalPath    = Path.GetDirectoryName(Open.FileName) + "\\";
                        OriginalMusic = new List <string>(Open.FileNames);
                        Music         = new List <string>(OriginalMusic);

                        CurrentSong = 0;
                        _choose.URL = Open.FileNames[CurrentSong];
                        SetDetails(Open.FileNames[CurrentSong]);

                        _choose.controls.stop();

                        lblDuration.Text = _choose.currentMedia.durationString;

                        InitializeDefaultSettings();
                    }
                }
            }
        }