static void Main(string[] args) { if (args.Length == 0) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain(false)); } if (args.Length == 1) { frm = new frmMain(true); ConsoleManager.Create(); System.Console.WriteLine("RUNNING"); CLI.run(args[0], frm); ConsoleManager.Destroy(); Environment.Exit(0); } }
/// <summary> /// Populates the Panel control with AlbumCover controls. /// /// TODO: Keep organization/order of images when updating the panel. /// </summary> /// <param name="pnl">The reference panel</param> /// <param name="frm">The calling form</param> public void PopulatePanel(ref Panel pnl, frmMain frm) { pnl.Controls.Clear(); int currX = 0; int currY = 0; // Add items for (int i = 0; i < ImagePaths.Length;i++ ) { AlbumCover album = new AlbumCover(); album.Width = AlbumWidth; album.Height = AlbumHeight; album.CoverImage = Image.FromFile(ImagePaths[i]); album.Location = new Point(currX, currY); currX += AlbumWidth; // This is probably not how you want to assign event handlers... album.MouseDown += new MouseEventHandler(frm.Album_MouseDown); album.MouseMove += new MouseEventHandler(frm.Album_MouseMove); if (currX == (GridCols * AlbumWidth)) { // End of the row currX = 0; currY += AlbumHeight; } // Add the control pnl.Controls.Add(album); } }