private void PlaceThumbnailOrders(object sender, DoWorkEventArgs doWorkEventArgs)
{
//var state = (ProgressState)doWorkEventArgs.Argument;
var exportFolder = Path.Combine(BookFolder, "Thumbnails");
//state.StatusLabel = "Creating thumbnail folder at " + exportFolder;
if (Directory.Exists(exportFolder))
{
//state.StatusLabel = "Deleting existing thumbnail directory";
SIL.IO.RobustIO.DeleteDirectory(exportFolder, true);
Thread.Sleep(1000); //let any open windows explorers deal with this before we move on
}
Directory.CreateDirectory(exportFolder);
//state.StatusLabel = "Creating Thumbnail Directory";
Thread.Sleep(1000); //let any open windows explorers deal with this before we move on
//state.StatusLabel = "Ordering page thumbnails";
foreach (var pageDom in GetPageDoms())
{
if (null != pageDom.SelectSingleNode("//div[contains(@class,'oddPage') or contains(@class,'evenPage') or contains(@class,'leftPage') or contains(@class,'rightPage') or contains(@class,'primerPage')]"))
{
// if(null != pageDom.SelectSingleNode("//div[contains(@class,'bloom-frontMatter')]"))
// continue; //c2 p2 had a term intro page with the class "rigthPage" which gives the prior query a false positive
const double kproportionOfWidthToHeightForB5 = 0.708;
const int heightInPixels = 700;
const int widthInPixels = (int) (heightInPixels*kproportionOfWidthToHeightForB5);
GetThumbnailAsync(widthInPixels, heightInPixels, pageDom, image => ThumbnailReady(exportFolder, pageDom, image),
error => HandleThumbnailerError(pageDom, error));
}
}
//this folder won't be fully populated yet, but as they watch it will fill up
Process.Start("explorer.exe", " \"" + exportFolder + "\"");
//state.WriteToLog("Now sit tight and wait for the thumbnail directory to stop filling up.");
}