private async Task <DeviceBatchScanVM> InitializeAsync(DeviceBatch batch) { return(await Task.Run(async() => { InstrumentService.LJVScanCoordinator.PurgeSubscribers(); InstrumentService.LJVScanCoordinator.SelectedCoordsDict = InstrumentService.LJVScanCoordinator.TheCoordsDictsDict["XinYan"]; theDeviceBatch = batch; //calculate presentTestCondition HashSet <string> testConditionsFromChildren = new HashSet <string>(); foreach (Device d in theDeviceBatch.Devices) { foreach (DeviceLJVScanSummary summary in d.DeviceLJVScanSummaries) { testConditionsFromChildren.Add(summary.TestCondition); } } int numberOfScans = testConditionsFromChildren.Count; int daysSinceFabrication = (DateTime.Now - theDeviceBatch.FabDate).Days; string presentTestCondition = string.Concat("t", numberOfScans + 1, ".", daysSinceFabrication); BatchScanSpec.TestCondition = presentTestCondition; Debug.WriteLine("presentTestCondition: " + presentTestCondition); //create sdsvms for each device foreach (Device d in theDeviceBatch.Devices) { var newSDSVM = await SingleDeviceScanVM.CreateAsync(d, ctx); newSDSVM.SaveDirectory = string.Concat(theDeviceBatch.FilePath, @"\", presentTestCondition); ScanVMs.Add(newSDSVM); } UpdateBatchScanSpec(); //CopyPreviousScanSpecs(); ScanVMs.OrderBy(x => x.TheDeviceVM.TheDevice.BatchIndex); ScanSelectedDevicesCommand = AsyncCommand.Create(token => ScanSelectedDevices(token)); string prCamModel = ConfigurationManager.AppSettings.Get("BatchTestSystem"); if (prCamModel == "BTS1") { delaysDict["Initialize"] = 50000; delaysDict["Swap"] = 42000; } else if (prCamModel == "BTS2") { delaysDict["Initialize"] = 17000; delaysDict["Swap"] = 23000; TheImagingControl = InstrumentService.LJVScanCoordinator.TheImagingControl; } else { Debug.WriteLine("BatchTestSystem needs to be properly set in App.Config"); } return this; }).ConfigureAwait(false)); }
public static Task <SingleDeviceScanVM> ManualSweepCreateAsync() { var ret = new SingleDeviceScanVM(); return(ret.ManualSweepInitializeAsync()); }
public static Task <SingleDeviceScanVM> CreateAsync(Device dev, DeviceBatchContext context) { var ret = new SingleDeviceScanVM(); return(ret.InitializeAsync(dev, context)); }