Ejemplo n.º 1
0
        public void addSongRows(Song[] songs)
        {
            foreach (SongRow row in songRows)
            {
                this.Controls.Remove(row);
                this.Height -= row.Height;
            }

            SongRow lastRow = null;
            foreach (Song s in songs)
            {
                SongRow row = new SongRow(_controller, s, _album, this);
                this.Controls.Add(row);
                if (lastRow == null)
                    row.Top = this.songLabel.Top + this.songLabel.Height + 5;
                else
                    row.Top = lastRow.Top + lastRow.Height;

                lastRow = row;
                songRows.Add(row);

                this.Height += row.Height;
                row.Show();
            }
        }
Ejemplo n.º 2
0
        public SongRow(Controller c, Song s, Album a, AddAlbum view)
        {
            _controller = c;
            _model = s;
            _parent = a;
            _view = view;

            InitializeComponent();

            this.songName.Text = _model.getName();
            this.lengthLabel.Text = parseTime(_model.getlength());
        }
Ejemplo n.º 3
0
 public bool addSong(Song s)
 {
     try
     {
         songs.Add(s);
     }
     catch
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 4
0
        internal bool saveSong(AddSong addSong, string name, string length, bool isEdit, AddAlbum view)
        {
            if (name.Length == 0)
            {
                showMessage(true, "Song must have a name");
                return false;
            }
            else if (length.Length == 0)
            {
                showMessage(true, "Song must have a length");
                return false;
            }
            else if (!length.StartsWith("PT"))
            {
                showMessage(true, "Song length must be of format: PT##M##S");
                return false;
            }

            if (SongRow.parseTime(length).Equals("ERROR"))
            {
                showMessage(true, "Song length must be of format: PT##M##S");
                return false;
            }

            if (isEdit)
            {
                songHighlight.setName(name);
                songHighlight.setLength(length);
            }
            else
            {
                Song s = new Song();
                s.setName(name);
                s.setLength(length);
                addingSongs.Add(s);
                songHighlight = s;
            }

            List<Song> temp = new List<Song>();
            temp.AddRange(albumHighlight.getSongs());
            if(addingSongs != null)
                temp.AddRange(addingSongs);

            view.addSongRows(temp.ToArray());

            return true;
        }
Ejemplo n.º 5
0
        public void songClick(SongRow row, Song s, Album a, AddAlbum view)
        {
            foreach(SongRow srow in view.getSongRows())
                srow.setNormal();
            row.setGreen();

            songHighlight = s;

            view.enableEdit();
        }
Ejemplo n.º 6
0
        private Album albumParser(XmlNodeReader reader)
        {
            string name = reader.GetAttribute("name");
            Album a = new Album(name);

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name == "song")
                    {
                        Song s = new Song();
                        reader.Read();
                        reader.Read();
                        s.setName(reader.Value);
                        reader.Read();
                        reader.Read();
                        reader.Read();
                        s.setLength(reader.Value);

                        a.addSong(s);
                    }
                    if (reader.Name == "reviewer")
                    {
                        Review r = new Review(reader.GetAttribute("ref"));
                        reader.Read();
                        r.setReview(reader.Value);

                        a.addReview(r);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                    if (reader.Name == "album")
                        break;
            }

            return a;
        }
Ejemplo n.º 7
0
 internal void removeSong(Song songHighlight)
 {
     this.songs.Remove(songHighlight);
 }