public SRControl StartSRControl(SRInstrument sr, ProgressChangedEventHandler pceh, SROpCompletedEventHandler opeh) { SRControlThread srct; if (threads.ContainsKey(sr.id)) { srct = threads[sr.id]; return(srct.SRCtrl); // what? } // lookup the associated detector for the SRInstrument (match on DSID) Detector det = meas.Detectors.GetIt(sr.id); // in practice this is always the same as meas.Detector // must be there! srct = new SRControlThread(threads.Count + 1, logger, meas, det); srct.sri = sr; threads[sr.id] = srct; srct.WorkerReportsProgress = true; srct.WorkerSupportsCancellation = true; srct.DoWork += new DoWorkEventHandler(ThreadOp); srct.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Done); srct.ProgressChanged += new ProgressChangedEventHandler(pceh); srct.SROpCompleted += new SROpCompletedEventHandler(opeh); srct.RunWorkerAsync(sr); return(srct.SRCtrl); }
public SRControl StartSRControl(SRInstrument sr, ProgressChangedEventHandler pceh, SROpCompletedEventHandler opeh) { SRControlThread srct; if (threads.ContainsKey(sr.id)) { srct = threads[sr.id]; return srct.SRCtrl; // what? } // lookup the associated detector for the SRInstrument (match on DSID) Detector det = meas.Detectors.GetIt(sr.id); // must be there! srct = new SRControlThread(threads.Count + 1, logger, meas, det); srct.sri = sr; threads[sr.id] = srct; srct.WorkerReportsProgress = true; srct.WorkerSupportsCancellation = true; srct.DoWork += new DoWorkEventHandler(ThreadOp); srct.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Done); srct.ProgressChanged += new ProgressChangedEventHandler(pceh); srct.SROpCompleted += new SROpCompletedEventHandler(opeh); srct.RunWorkerAsync(sr); return srct.SRCtrl; }