Beispiel #1
0
        private void AnalysisWizardClick(object sender, RoutedEventArgs e)
        {
            AcquireParameters acq = null;
            Detector          det = null;

            NC.App.DB.ResetAcquireParametersMap();              // force read from DB to get as-is default acquire state
            // NEXT: do a refresh of the specific acquire instance, not the entire list
            Integ.GetCurrentAcquireDetectorPair(ref acq, ref det);
            if (!det.ListMode)
            {
                MessageBox.Show("'" + det.ToString() + "' is not a List Mode detector,\r\ncreate or select a List Mode detector\r\n with Setup > Facility/Inspection...", "List Mode Acquire");
                return;
            }
            LMAcquire a = new LMAcquire(acq, det);

            a.ShowDialog();
            if (a.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                if (acq.modified || acq.lm.modified)
                {
                    INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, DateTime.Now);
                    acq.MeasDateTime = sel.TimeStamp; acq.lm.TimeStamp = sel.TimeStamp;
                    NC.App.DB.AddAcquireParams(sel, acq);  // it's a new one, not the existing one modified
                }

                switch (NC.App.Opstate.Measurement.AcquireState.data_src)  // global access to latest acq here, same as acq set in wizard
                {
                case ConstructedSource.Live:
                    UIIntegration.Controller.file = false;   // make sure to use the DAQ controller, not the file controller
                    NC.App.AppContext.FileInput   = null;    // reset the cmd line file input flag
                    if (NC.App.Opstate.Measurement.Detector.ListMode)
                    {
                        // if ok, the analyzers are set up, so can kick it off now.
                        if (NC.App.Opstate.Measurement.Detector.Id.SRType == InstrType.PTR32)
                        {
                            Ptr32Instrument instrument = new Ptr32Instrument(NC.App.Opstate.Measurement.Detector);
                            instrument.DAQState = DAQInstrState.Offline;
                            instrument.selected = true;
                            instrument.Init(NC.App.Logger(LMLoggers.AppSection.Data), NC.App.Logger(LMLoggers.AppSection.Analysis));      // redundant now
                            instrument.RDT.ResetRawDataBuffer();
                            instrument.RDT.SetLMStateFlags(((LMConnectionInfo)(instrument.id.FullConnInfo)).NetComm);
                            if (!Instruments.Active.Contains(instrument))
                            {
                                Instruments.Active.Add(instrument);
                            }
                        }
                        else if (NC.App.Opstate.Measurement.Detector.Id.SRType == InstrType.MCA527)
                        {
                            MCA527Instrument mca = new MCA527Instrument(NC.App.Opstate.Measurement.Detector);
                            mca.DAQState = DAQInstrState.Offline;                                                             // these are manually initiated as opposed to auto-pickup
                            mca.selected = true;
                            mca.Init(NC.App.Logger(LMLoggers.AppSection.Data), NC.App.Logger(LMLoggers.AppSection.Analysis)); // redundant now?
                            if (!Instruments.Active.Contains(mca))
                            {
                                Instruments.Active.Add(mca);
                            }
                        }
                        else                                 // LMMM
                        {
                            LMInstrument lm = new LMInstrument(NC.App.Opstate.Measurement.Detector);
                            lm.DAQState = DAQInstrState.Offline; // these are manually initiated as opposed to auto-pickup
                            lm.selected = false;                 //must broadcast first to get it selected
                            if (!Instruments.All.Contains(lm))
                            {
                                Instruments.All.Add(lm);     // add to global runtime list
                            }
                        }
                    }
                    else
                    {
                        SRInstrument sri = new SRInstrument(NC.App.Opstate.Measurement.Detector);
                        sri.selected = true;
                        sri.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                        if (!Instruments.All.Contains(sri))
                        {
                            Instruments.All.Add(sri);     // add to global runtime list
                        }
                    }
                    break;

                case ConstructedSource.DB:
                    UIIntegration.Controller.file = true;
                    return;

                //break;
                case ConstructedSource.Manual:
                    UIIntegration.Controller.file = true;
                    return;

                //break;
                case ConstructedSource.CycleFile:
                case ConstructedSource.ReviewFile:
                    UIIntegration.Controller.file = true;
                    string xs = UIIntegration.GetUsersFolder("Select Input Folder", NC.App.AppContext.FileInput);
                    if (!string.IsNullOrEmpty(xs))
                    {
                        NC.App.AppContext.FileInput     = xs;
                        NC.App.AppContext.FileInputList = null;      // no explicit file list
                    }
                    SRInstrument sri2 = new SRInstrument(NC.App.Opstate.Measurement.Detector);
                    sri2.selected = true;
                    sri2.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                    if (!Instruments.All.Contains(sri2))
                    {
                        Instruments.All.Add(sri2);     // add to global runtime list
                    }
                    break;

                case ConstructedSource.NCDFile:
                    NC.App.AppContext.NCDFileAssay = true;     // suntoucher, this is right here how we're flowing now
                    UIIntegration.Controller.file  = true;
                    break;

                case ConstructedSource.SortedPulseTextFile:
                    NC.App.AppContext.PulseFileAssay = true;
                    UIIntegration.Controller.file    = true;
                    break;

                case ConstructedSource.PTRFile:
                    NC.App.AppContext.PTRFileAssay = true;
                    UIIntegration.Controller.file  = true;
                    break;

                case ConstructedSource.MCA527File:
                    NC.App.AppContext.MCA527FileAssay = true;
                    UIIntegration.Controller.file     = true;
                    break;

                default:
                    break;
                }
                NC.App.Opstate.Measurement.Detector.Id.source = NC.App.Opstate.Measurement.AcquireState.data_src; // set the detector overall data source value here
                UIIntegration.Controller.SetAssay();                                                              // tell the controller to do an assay operation using the current measurement state
                UIIntegration.Controller.Perform();                                                               // start the measurement file or DAQ thread
            }
        }
Beispiel #2
0
        private void AnalysisWizardClick(object sender, RoutedEventArgs e)
        {
            AcquireParameters acq = null;
            Detector det = null;
            NC.App.DB.ResetAcquireParametersMap();  // force read from DB to get as-is default acquire state
            // NEXT: do a refresh of the specific acquire instance, not the entire list
            Integ.GetCurrentAcquireDetectorPair(ref acq, ref det);
            if (!det.ListMode)
            {
                MessageBox.Show("'" + det.ToString() + "' is not a List Mode detector,\r\ncreate or select a List Mode detector\r\n with Setup > Facility/Inspection...", "List Mode Acquire");
                return;
            }
            LMAcquire a = new LMAcquire(acq, det);
            a.ShowDialog();
            if (a.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                if (acq.modified || acq.lm.modified)
                {
                    INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, DateTime.Now);
                    acq.MeasDateTime = sel.TimeStamp; acq.lm.TimeStamp = sel.TimeStamp;
                    NC.App.DB.AddAcquireParams(sel, acq);  // it's a new one, not the existing one modified
                }

                switch (NC.App.Opstate.Measurement.AcquireState.data_src)  // global access to latest acq here, same as acq set in wizard
                {
                    case ConstructedSource.Live:
                        UIIntegration.Controller.file = false;  // make sure to use the DAQ controller, not the file controller
                        NC.App.AppContext.FileInput = null;  // reset the cmd line file input flag
                        if (NC.App.Opstate.Measurement.Detector.ListMode)
                        {
                            // if ok, the analyzers are set up, so can kick it off now.
                            if (NC.App.Opstate.Measurement.Detector.Id.SRType == InstrType.PTR32)
                            {
                                Ptr32Instrument instrument = new Ptr32Instrument(NC.App.Opstate.Measurement.Detector);
                                instrument.DAQState = DAQInstrState.Offline;
                                instrument.selected = true;
                                instrument.Init(NC.App.Logger(LMLoggers.AppSection.Data), NC.App.Logger(LMLoggers.AppSection.Analysis));  // redundant now
                                instrument.RDT.ResetRawDataBuffer();
                                instrument.RDT.SetLMStateFlags(((LMConnectionInfo)(instrument.id.FullConnInfo)).NetComm);
                                if (!Instruments.Active.Contains(instrument))
                                    Instruments.Active.Add(instrument);
                            }
                            else if (NC.App.Opstate.Measurement.Detector.Id.SRType == InstrType.MCA527)
                            {
                                MCA527Instrument mca = new MCA527Instrument(NC.App.Opstate.Measurement.Detector);
                                mca.DAQState = DAQInstrState.Offline; // these are manually initiated as opposed to auto-pickup
                                mca.selected = true;
                                mca.Init(NC.App.Logger(LMLoggers.AppSection.Data), NC.App.Logger(LMLoggers.AppSection.Analysis)); // redundant now?
                                if (!Instruments.Active.Contains(mca))
                                    Instruments.Active.Add(mca);
                            }
                            else // LMMM
                            {
                                LMInstrument lm = new LMInstrument(NC.App.Opstate.Measurement.Detector);
                                lm.DAQState = DAQInstrState.Offline; // these are manually initiated as opposed to auto-pickup
                                lm.selected = false;  //must broadcast first to get it selected
                                if (!Instruments.All.Contains(lm))
                                    Instruments.All.Add(lm); // add to global runtime list
                            }
                        }
                        else
                        {
                            SRInstrument sri = new SRInstrument(NC.App.Opstate.Measurement.Detector);
                            sri.selected = true;
                            sri.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                            if (!Instruments.All.Contains(sri))
                                Instruments.All.Add(sri); // add to global runtime list
                        }
                        break;
                    case ConstructedSource.DB:
                        UIIntegration.Controller.file = true;
                        return;
                        //break;
                    case ConstructedSource.Manual:
                        UIIntegration.Controller.file = true;
                        return;
                        //break;
                    case ConstructedSource.CycleFile:
                    case ConstructedSource.ReviewFile:
                        UIIntegration.Controller.file = true;
                        string xs = UIIntegration.GetUsersFolder("Select Input Folder", NC.App.AppContext.FileInput);
                        if (!string.IsNullOrEmpty(xs))
                        {
                            NC.App.AppContext.FileInput = xs;
                            NC.App.AppContext.FileInputList = null;  // no explicit file list
                        }
                        SRInstrument sri2 = new SRInstrument(NC.App.Opstate.Measurement.Detector);
                        sri2.selected = true;
                        sri2.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                        if (!Instruments.All.Contains(sri2))
                            Instruments.All.Add(sri2); // add to global runtime list
                        break;

                    case ConstructedSource.NCDFile:
                        NC.App.AppContext.NCDFileAssay = true; // suntoucher, this is right here how we're flowing now
                        UIIntegration.Controller.file = true;
                        break;
                    case ConstructedSource.SortedPulseTextFile:
                        NC.App.AppContext.PulseFileAssay = true;
                        UIIntegration.Controller.file = true;
                        break;
                    case ConstructedSource.PTRFile:
                        NC.App.AppContext.PTRFileAssay = true;
                        UIIntegration.Controller.file = true;
                        break;
                    case ConstructedSource.MCA527File:
                        NC.App.AppContext.MCA527FileAssay = true;
                        UIIntegration.Controller.file = true;
                        break;
                    default:
                        break;
                }
                NC.App.Opstate.Measurement.Detector.Id.source = NC.App.Opstate.Measurement.AcquireState.data_src;  // set the detector overall data source value here
                UIIntegration.Controller.SetAssay();  // tell the controller to do an assay operation using the current measurement state
                UIIntegration.Controller.Perform();  // start the measurement file or DAQ thread
            }
        }