void cmdAddApplication_Click(object sender, EventArgs e) { try { NewAppWizard wizard = new NewAppWizard(); wizard.ShowDialog(); PDFScanAndSort.Models.Application app = wizard.Application; wizard.Dispose(); GroupControl gc = new GroupControl(); gc.Text = app.Name; gc.Dock = DockStyle.Top; gc.Width = 446; gc.Height = 165; xtraScrollableControl1.Controls.Add(gc); xtraScrollableControl1.Controls.SetChildIndex(gc, 0); FlowLayoutPanel panelLong = new FlowLayoutPanel(); panelLong.Width = 442; panelLong.Height = 142; panelLong.AutoSize = false; panelLong.AutoScroll = true; panelLong.WrapContents = false; panelLong.Dock = DockStyle.Top; panelLong.HorizontalScroll.Value = 0; gc.Controls.Add(panelLong); //create application class app.Name = app.Name; applications.Add(app); for (int i = 0; i < app.NumberOfPages; i++) { FlowLayoutPanel pictureContainer = new FlowLayoutPanel(); pictureContainer.Width = 85; pictureContainer.Height = 111; pictureContainer.AutoSize = false; pictureContainer.AutoScroll = false; pictureContainer.BorderStyle = BorderStyle.FixedSingle; panelLong.Controls.Add(pictureContainer); Card picture = new Card(); picture.Width = 76; picture.Height = 75; picture.AutoSize = false; //picture.Image = Bitmap.FromFile(item); picture.BorderStyle = BorderStyle.FixedSingle; picture.SizeMode = PictureBoxSizeMode.StretchImage; pictureContainer.Controls.Add(picture); picture.Visible = true; picture.BorderStyle = BorderStyle.FixedSingle; picture.DragEnter += picture_DragEnter; picture.DragDrop += picture_DragDrop; picture.MouseDown += picture_MouseDown; picture.AllowDrop = true; Page page = new Page(); page.Card = picture; picture.Page = page; picture.Page.PageNumber = i; cards.Add(picture); // card.PageNumber = i; page.Application = app; // page.PictureBox = picture; app.Pages.Add(page); } //add the add and subtract buttons FlowLayoutPanel btnContainer = new FlowLayoutPanel(); btnContainer.Width = 42; btnContainer.Height = 111; btnContainer.AutoSize = false; btnContainer.AutoScroll = false; btnContainer.BorderStyle = BorderStyle.FixedSingle; btnContainer.WrapContents = true; SimpleButton newbtn = new SimpleButton(); newbtn.Text = "+"; newbtn.Width = 33; newbtn.Height = 48; newbtn.Click += newbtn_Click; SimpleButton removebtn = new SimpleButton(); removebtn.Text = "-"; removebtn.Width = 33; removebtn.Height = 48; removebtn.Click += removebtn_Click; btnContainer.Controls.Add(newbtn); btnContainer.Controls.Add(removebtn); panelLong.Controls.Add(btnContainer); } catch (Exception) { throw; } }
private void RefreshApplicationGUI() { //add new application button SimpleButton cmdAddApplication = new SimpleButton(); cmdAddApplication.Text = "Add New Application"; cmdAddApplication.Dock = DockStyle.Bottom; cmdAddApplication.Click += cmdAddApplication_Click; xtraScrollableControl1.Controls.Add(cmdAddApplication); //create apps in the UI var groupedAppList = records .GroupBy(u => u.Application) .Select(grp => grp.ToList()) .ToList(); foreach (var item in groupedAppList) { GroupControl gc = new GroupControl(); gc.Text = item[0].Application; gc.Dock = DockStyle.Top; gc.Width = 446; gc.Height = 165; xtraScrollableControl1.Controls.Add(gc); FlowLayoutPanel panelLong = new FlowLayoutPanel(); panelLong.Width = 442; panelLong.Height = 142; panelLong.AutoSize = false; panelLong.AutoScroll = true; panelLong.WrapContents = false; panelLong.Dock = DockStyle.Top; panelLong.HorizontalScroll.Value = 0; gc.Controls.Add(panelLong); //create application class PDFScanAndSort.Models.Application app = new PDFScanAndSort.Models.Application(); app.Name = item[0].Application; applications.Add(app); int i = 1; foreach (var rr in item) { FlowLayoutPanel pictureContainer = new FlowLayoutPanel(); pictureContainer.Width = 85; pictureContainer.Height = 111; pictureContainer.AutoSize = false; pictureContainer.AutoScroll = false; pictureContainer.BorderStyle = BorderStyle.FixedSingle; panelLong.Controls.Add(pictureContainer); Card picture = new Card(); picture.Width = 76; picture.Height = 75; picture.AutoSize = false; //picture.Image = Bitmap.FromFile(item); picture.BorderStyle = BorderStyle.FixedSingle; picture.SizeMode = PictureBoxSizeMode.StretchImage; pictureContainer.Controls.Add(picture); picture.Visible = true; picture.BorderStyle = BorderStyle.FixedSingle; picture.DragEnter += picture_DragEnter; picture.DragDrop += picture_DragDrop; picture.MouseDown += picture_MouseDown; picture.AllowDrop = true; Page page = new Page(); page.Card = picture; page.SearchStrings = rr.SearchTermStringList; picture.Page = page; picture.Page.PageNumber = i; cards.Add(picture); // card.PageNumber = i; page.Application = app; // page.PictureBox = picture; app.Pages.Add(page); i++; } //add the add and subtract buttons FlowLayoutPanel btnContainer = new FlowLayoutPanel(); btnContainer.Width = 42; btnContainer.Height = 111; btnContainer.AutoSize = false; btnContainer.AutoScroll = false; btnContainer.BorderStyle = BorderStyle.FixedSingle; btnContainer.WrapContents = true; SimpleButton newbtn = new SimpleButton(); newbtn.Text = "+"; newbtn.Width = 33; newbtn.Height = 48; newbtn.Click += newbtn_Click; SimpleButton removebtn = new SimpleButton(); removebtn.Text= "-"; removebtn.Width = 33; removebtn.Height = 48; removebtn.Click += removebtn_Click; btnContainer.Controls.Add(newbtn); btnContainer.Controls.Add(removebtn); panelLong.Controls.Add(btnContainer); } }