ScanMaster.Controller.ScanFinishedHandler C# (CSharp) Method

ScanFinishedHandler() private method

private ScanFinishedHandler ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        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();
            }
        }