Exemplo n.º 1
0
        public UpdatePlaylist(PlaylistContainer playlistContainer)
        {
            InitializeComponent();
            this.playlistContainer = playlistContainer;

            Title_TextBox.Text       = playlistContainer.playlistName;
            Description_TextBox.Text = playlistContainer.description;
            this.DoubleBuffered      = true;
            foreach (Control control in this.Controls)
            {
                MainScreen.EnableDoubleBuferring(control);
            }
        }
Exemplo n.º 2
0
        public void setDetailInfo(List <TrackInfo> trackInfos, Image[] cover, PlaylistContainer callFm, bool isChart)
        {
            this.trackInfo    = trackInfos;
            playlistContainer = callFm;
            int indexCount = 1;

            track_dataGridView.Rows.Clear();
            track_dataGridView.Rows.Add();
            track_dataGridView.Rows[0].Visible = false;
            rows.Clear();
            foreach (TrackInfo track in trackInfos)
            {
                DataGridViewRow tempRow = (DataGridViewRow)track_dataGridView.Rows[0].Clone();
                tempRow.Visible        = true;
                tempRow.Tag            = track;
                tempRow.Cells[0].Value = indexCount++;
                tempRow.Cells[1].Value = track.Title;
                tempRow.Cells[2].Value = track.Artist;
                tempRow.Cells[3].Value = track.DateAdded;
                tempRow.Cells[4].Value = track.Time;
                tempRow.Cells[5].Value = Properties.Resources.add;
                if (track.IsLoved)
                {
                    tempRow.Cells[6].Value = Properties.Resources.liked;
                }
                else
                {
                    tempRow.Cells[6].Value = Properties.Resources.like;
                }
                rows.Add(tempRow);
            }

            track_dataGridView.Rows.AddRange(rows.ToArray());

            int coverIndex = 0;

            for (int i = 0; i < playlistCover_pictureBox.Controls.Count; i++)
            {
                if (coverIndex >= cover.Length)
                {
                    break;
                }
                if (playlistCover_pictureBox.Controls[i] is PictureBox)
                {
                    PictureBox tempPb = playlistCover_pictureBox.Controls[i] as PictureBox;
                    tempPb.Image = cover[coverIndex++];
                }
                else
                {
                    continue;
                }
            }

            description_label.Text   = callFm.description;
            playlistTitle_label.Text = callFm.playlistName;

            TimeSpan time = TimeSpan.FromSeconds(callFm.timeInSec);

            string str = time.ToString(@"hh\:mm\:ss");

            createdBy_label.Text = "Created by " + callFm.owner + " - " + trackInfos.Count + " Tracks - " + str;
            //Created by me - 10 Tracks - 1:24:00

            track_dataGridView.Rows.Remove(track_dataGridView.Rows[0]);

            if (isChart)
            {
                deletePlaylist_button.Hide();
                chartCover_panel.BackgroundImage = callFm.playlistCover_panel.BackgroundImage;
                chartCover_panel.Show();
                chartCover_panel.BringToFront();
                //ẩn nút xóa
                track_dataGridView.Columns[7].Visible = false;

                editPlaylist_button.Hide();
            }
            else
            {
                deletePlaylist_button.Show();
                chartCover_panel.Hide();
                //hiện nút xóa
                track_dataGridView.Columns[7].Visible = true;

                editPlaylist_button.Show();
            }
            if (callFm.canDelete)
            {
                deletePlaylist_button.Show();
                editPlaylist_button.Show();
            }
            else
            {
                deletePlaylist_button.Hide();
                editPlaylist_button.Hide();
            }

            hideLoading();
        }