Exemple #1
0
 private void btnInsert_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.FormCompleted() && EnglishMoreDataExist())
         {
             this.playlistToComplete.SetPlaylist(txtDirectory.Text);
             this.playlistToComplete.cover       = txtCover.Text;
             this.playlistToComplete.year        = txtYear.Text == "" ? 0 : Convert.ToInt32(txtYear.Text);
             this.playlistToComplete.ageCategory = cmbAge.Items[cmbAge.SelectedIndex].ToString();
             string[] str = new string[lstGenres.SelectedItems.Count];
             int      i   = 0;
             foreach (object x in lstGenres.SelectedItems)
             {
                 str[i++] = lstGenres.GetItemText(x);
             }
             this.playlistToComplete.genre      = str;
             this.playlistToComplete.num_tracks = DiskIO.GetFilesNumber(this.playlistToComplete.playlist, "*.mp3");
             // apply english language
             this.playlistToComplete.title       = nonEngAdditionalData["English"].title;
             this.playlistToComplete.artist      = nonEngAdditionalData["English"].artist;
             this.playlistToComplete.description = nonEngAdditionalData["English"].description;
             // apply for other languages
             nonEngAdditionalData.Remove("English");
             foreach (KeyValuePair <string, MusicPlaylist> x in this.nonEngAdditionalData)
             {
                 x.Value.id = this.playlistToComplete.id;
                 x.Value.SetPlaylist(txtDirectory.Text);
                 x.Value.cover       = txtCover.Text;
                 x.Value.year        = txtYear.Text == "" ? 0 : Convert.ToInt32(txtYear.Text);
                 x.Value.ageCategory = cmbAge.Items[cmbAge.SelectedIndex].ToString();
                 str = new string[lstGenres.SelectedItems.Count];
                 i   = 0;
                 foreach (object obj in lstGenres.SelectedItems)
                 {
                     str[i++] = lstGenres.GetItemText(obj);
                 }
                 x.Value.genre      = str;
                 x.Value.num_tracks = DiskIO.GetFilesNumber(this.playlistToComplete.playlist, "*.mp3");
             }
             this.DialogResult = DialogResult.OK;
         }
         else
         {
             MessageBox.Show("Please fill Directory, Age, Genre and English Additional data first.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception exp)
     {
         Program.ShowExceptionData(exp);
     }
 }