private void ScanFinishedHandler(object sender, EventArgs e)
{
lock (this)
{
// update the datastore
dataStore.UpdateTotal();
// save the acquisitior settings in the scan
WriteScanSettings(DataStore.CurrentScan);
// serialize the last scan
string tempPath = Environment.GetEnvironmentVariable("TEMP") + "\\ScanMasterTemp";
if (!Directory.Exists(tempPath)) Directory.CreateDirectory(tempPath);
serializer.SerializeScanAsBinary(tempPath + "\\scan_" +
dataStore.NumberOfScans.ToString(), dataStore.CurrentScan);
dataStore.ClearCurrentScan();
// tell the viewers that the scan is finished
viewerManager.ScanFinished();
// hint to the GC that now might be a good time
GC.Collect();
}
}