コード例 #1
0
ファイル: EditAlbum.cs プロジェクト: orestescm76/cassiopeia
        private void botonOkDoomer_Click(object sender, EventArgs e)
        {
            try//si está vacío pues guarda vacío
            {
                Log.Instance.PrintMessage("Trying to save", MessageType.Info);
                albumAEditar.Artist = textBoxArtista.Text;
                albumAEditar.Title  = textBoxTitulo.Text;
                albumAEditar.Year   = Convert.ToInt16(textBoxAño.Text);
                string gn = comboBoxGeneros.SelectedItem.ToString();
                Genre  g  = Kernel.Genres[Kernel.FindTranslatedGenre(gn)];
                albumAEditar.Genre     = g;
                albumAEditar.Type      = (AlbumType)comboBoxAlbumType.SelectedIndex;
                albumAEditar.CoverPath = labelRuta.Text;
                TimeSpan nuevaDuracion = new TimeSpan();
                albumAEditar.SoundFilesPath = labelDirectorioActual.Text;
                string[] uriSpotify = textBoxURISpotify.Text.Split(':');
                if (uriSpotify.Length == 3)
                {
                    albumAEditar.IdSpotify = (uriSpotify[2]);
                }
                else
                {
                    albumAEditar.IdSpotify = (textBoxURISpotify.Text);
                }
                foreach (Song c in albumAEditar.Songs)
                {
                    if (!c.IsBonus)
                    {
                        nuevaDuracion += c.Length;
                    }
                }
            }
            catch (NullReferenceException)
            {
                Log.Instance.PrintMessage("Can't save the edit", MessageType.Warning);
                MessageBox.Show(Kernel.LocalTexts.GetString("error_vacio1"));
            }

            catch (FormatException)
            {
                Log.Instance.PrintMessage("Wrong input, won't change anything", MessageType.Warning);
                MessageBox.Show(Kernel.LocalTexts.GetString("error_formato"));
                //throw;
            }
            catch (IndexOutOfRangeException)
            {
                Log.Instance.PrintMessage("Wrong input, won't change anything", MessageType.Warning);
                MessageBox.Show(Kernel.LocalTexts.GetString("error_formato"));
            }
            if (!fromMainView)
            {
                AlbumViewer nuevo = new AlbumViewer(ref albumAEditar);
                nuevo.Show();
            }
            Kernel.ReloadView();
            Close();
            Log.Instance.PrintMessage("Saved correctly", MessageType.Correct);
            Kernel.SetSaveMark();
        }
コード例 #2
0
ファイル: EditAlbum.cs プロジェクト: orestescm76/cassiopeia
 private void botonCancelar_Click(object sender, EventArgs e)
 {
     if (!fromMainView)
     {
         AlbumViewer nuevo = new AlbumViewer(ref albumAEditar);
         nuevo.Show();
     }
     Close();
 }