예제 #1
0
        private void esLarga_Click(object sender, EventArgs e)
        {
            CreateSong larga = new CreateSong(ref album, cual, true);

            DialogResult = DialogResult.OK;
            larga.ShowDialog();
        }
예제 #2
0
        private void buttonAñadirCancion_Click(object sender, EventArgs e)
        {
            Log.Instance.PrintMessage("Trying to add a song", MessageType.Info);
            CreateSong AC = new CreateSong(ref albumAEditar, -2);

            AC.ShowDialog();
            borrarVista();
            cargarVista();
        }
예제 #3
0
        private void vistaCanciones_MouseDoubleClick(object sender, MouseEventArgs e) //editar cancion
        {
            Log.Instance.PrintMessage("Editing song", MessageType.Info);
            String     text           = vistaCanciones.SelectedItems[0].Text;
            Song       cancionAEditar = albumAEditar.GetSong(text);
            CreateSong editarCancion  = new CreateSong(ref cancionAEditar);

            editarCancion.ShowDialog();
            cargarVista();
            Log.Instance.PrintMessage("Saved!", MessageType.Correct);
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (!larga && cancionlarga is null) //caso normal
                {
                    min   = Convert.ToInt32(minTextBox.Text);
                    sec   = Convert.ToInt32(secsTextBox.Text);
                    title = tituloTextBox.Text;
                    bonus = checkBoxBonus.Checked;
                    if (editar) //si edita
                    {
                        cancion.Title   = title;
                        cancion.Length  = new TimeSpan(0, min, sec);
                        cancion.IsBonus = bonus;
                        DialogResult    = DialogResult.OK;
                        Close();
                    }
                    else
                    {
                        Song c = new Song(title, new TimeSpan(0, min, sec), ref album, bonus);
                        album.AddSong(c);
                        DialogResult = DialogResult.OK;
                        Close();
                    }
                }
                else if (larga && cancionlarga is null) //caso de que creemos una cancion larga, sin partes
                {
                    title = tituloTextBox.Text;
                    min   = sec = 0;
                    np    = Convert.ToInt32(textBoxNumPartes.Text);
                    LongSong longSong = new LongSong(title, album);

                    album.AddSong(longSong);
                    for (int i = 0; i < np; i++)
                    {
                        CreateSong addParte = new CreateSong(ref longSong, i + 1, ref album);
                        addParte.ShowDialog();
                        if (addParte.DialogResult == DialogResult.Cancel)
                        {
                            break;
                        }
                        else
                        {
                            DialogResult = DialogResult.OK;
                        }
                    }
                }
                else if (cancionlarga is not null && larga == true)//parte de una cancion normal
                {
                    title = tituloTextBox.Text;
                    min   = Convert.ToInt32(minTextBox.Text);
                    sec   = Convert.ToInt32(secsTextBox.Text);
                    TimeSpan dur = new TimeSpan(0, min, sec);
                    np = 0;
                    Song p = new Song(title, dur, ref album);
                    cancionlarga.AddPart(p);
                    DialogResult = DialogResult.OK;
                }
                Dispose();
            }
            catch (NullReferenceException ex)
            {
                Log.Instance.PrintMessage(ex.Message, MessageType.Error);

                MessageBox.Show(Kernel.LocalTexts.GetString("error_vacio1"));
            }

            catch (FormatException ex)
            {
                Log.Instance.PrintMessage(ex.Message, MessageType.Error);
                MessageBox.Show(Kernel.LocalTexts.GetString("error_formato"));
                //throw;
            }
        }
예제 #5
0
        private void buttonAddAlbum_Click(object sender, EventArgs e)
        {
            string title, artist;
            bool   cancelado = false;
            short  year, nC;

            try
            {
                title  = tituloTextBox.Text;
                artist = artistaTextBox.Text;
                int    gn   = comboBoxGenres.SelectedIndex;
                string gent = comboBoxGenres.SelectedItem.ToString();
                year = Convert.ToInt16(yearTextBox.Text);
                nC   = Convert.ToInt16(numCancionesTextBox.Text);
                Genre     g = Kernel.Genres[Kernel.FindTranslatedGenre(gent)];
                AlbumData a = null;
                if (caratula == "")
                {
                    a = new AlbumData(g, title, artist, year, "");
                }
                else
                {
                    a = new AlbumData(g, title, artist, year, caratula);
                }
                Kernel.Collection.AddAlbum(ref a);
                DialogResult cancelar = DialogResult.OK;
                for (int i = 0; i < nC; i++)
                {
                    CreateSong agregarCancion = new CreateSong(ref a, i);
                    Hide();
                    cancelar = agregarCancion.ShowDialog();
                    if (cancelar == DialogResult.Cancel)
                    {
                        Log.Instance.PrintMessage("Canceled", MessageType.Warning);
                        Kernel.Collection.RemoveAlbum(ref a);
                        Close();
                        cancelado = true;
                        break;
                    }
                    else if (cancelar == DialogResult.None)
                    {
                        continue;
                    }
                }
                if (!cancelado)
                {
                    Log.Instance.PrintMessage(artist + " - " + title + " added OK", MessageType.Correct);
                    Kernel.SetSaveMark();
                }

                Kernel.ReloadView();
                Close();
            }
            catch (NullReferenceException ex)
            {
                Log.Instance.PrintMessage(ex.Message, MessageType.Error);
                MessageBox.Show(Kernel.LocalTexts.GetString("error_vacio1"));
            }

            catch (FormatException ex)
            {
                Log.Instance.PrintMessage(ex.Message, MessageType.Error);
                MessageBox.Show(Kernel.LocalTexts.GetString("error_formato"));
                //throw;
            }
        }