Esempio n. 1
0
        private void CreatePlayList_Button_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(Title_TextBox.Text) || Title_TextBox.ForeColor == Color.Gray)
            {
                MessageBox.Show("PlayList name cannot be blank");
                return;
            }
            if (string.IsNullOrWhiteSpace(Description_TextBox.Text) || Description_TextBox.ForeColor == Color.Gray)
            {
                Description_TextBox.Text = null;
            }
            Button newbutton = new Button();

            newbutton.FlatStyle = FlatStyle.Flat;
            newbutton.FlatAppearance.BorderSize = 0;
            newbutton.Text      = Title_TextBox.Text;
            newbutton.Font      = new Font("Segoe UI", 12);
            newbutton.AutoSize  = false;
            newbutton.Cursor    = Cursors.Hand;
            newbutton.TextAlign = ContentAlignment.MiddleLeft;
            newbutton.ForeColor = Color.White;
            newbutton.Width     = 210;
            newbutton.Height    = 46;
            PlaylistMenu_panel.FlowDirection            = FlowDirection.TopDown;
            newbutton.MouseClick                       += mainScr.menuPanelPlaylists_button_MouseClick;
            newbutton.FlatAppearance.MouseOverBackColor = Color.FromArgb(76, 78, 84);



            if (!Database.checkIfPlaylistExisted(Title_TextBox.Text, mainScr.CurrentUser.UserID))
            {
                MessageBox.Show("Name existed , may be try another name ?");
            }
            else
            {
                Database.createPlaylist(mainScr.CurrentUser.UserID, Title_TextBox.Text, Description_TextBox.Text);
                PlaylistMenu_panel.Controls.Add(newbutton);
                //reload playlist form when created new playlist
                if (addtoPlaylistForm != null)
                {
                    addtoPlaylistForm.loadPlaylist_InFlowPanel();
                }
                mainScr.playlistScr.reload_createNew();
                this.Close();
            }
        }