public static void PackDatabase(string fsPath) { List <GradeDigest> gradeDigests = GradeFS.LoadDigests(fsPath); GradeDigestSet digestSet = new GradeDigestSet(gradeDigests); digestSet.Save(fsPath + "/grade-digests.db"); }
public MassGradeView(Size picSize, Func <Bitmap, Bitmap> converter) { InitializeComponent(); int W = 1900; int H = 1000; int frameW = 15; int frameH = 37; int cx = (W - frameW) / (picSize.Width + 1); int cy = (H - frameH) / (picSize.Height + 1); List <PictureView> pvs = new List <PictureView>(); for (int y = 0; y < cy; y++) { for (int x = 0; x < cx; x++) { var pv = new PictureView(); pvs.Add(pv); pv.Size = picSize; pv.Location = new Point(x * (picSize.Width + 1), y * (picSize.Height + 1)); pv.ZoomToFit(); pv.AllowZoom = false; this.Controls.Add(pv); } } this.Size = new Size(cx * (picSize.Width + 1) + frameW, cy * (picSize.Height + 1) + frameH); Console.WriteLine("placed {0} pictures in mass view", cx * cy); this.Shown += new EventHandler(delegate { Thread worker = new Thread(new ThreadStart(delegate { List <string> images = GradeFS.GetGradeFileNames(OcrData); // shuffle images Random r = new Random(); images = images.OrderBy(s => r.NextDouble()).ToList(); for (int q = 0; q < pvs.Count; q++) { string imageFile = images[q]; Bitmap img = ImageUtil.LoadImage(imageFile); pvs[q].Image = converter(img); pvs[q].DoubleClick += new EventHandler(delegate { new GradeRecognitionDebugView(img, imageFile).ShowDialog(); }); } })); worker.IsBackground = true; worker.Start(); }); }