Пример #1
0
        public SpectForm(ref OmniDriver.NETWrapper wrapper, bool loadDefaults)
        {
            wrapper.openAllSpectrometers();
            InitializeComponent();

            for (int i = 0; i < wrapper.getNumberOfSpectrometersFound(); ++i)
            {
                indexComboBox.Items.Add(wrapper.getSerialNumber(i) + "(Index: " + i + ")");
            }
            String[] ports = SerialPort.GetPortNames();
            valveComboBox.Items.AddRange(ports);
            FCComboBox.Items.AddRange(ports);

            //wczytaj default
            if (loadDefaults)
            {
                try
                {
                    XDocument doc     = XDocument.Load(path + "\\default.xml");
                    var       options = doc.Root;
                    indexComboBox.SelectedIndex = Int32.Parse(options.Element("Index").Value);
                    IntegrTTextBox.Text         = (string)options.Element("Integration_Time").Value;
                    AverageTTextBox.Text        = (string)options.Element("Average").Value;
                    BoxcarWidthTextBox.Text     = (string)options.Element("Boxcar_Width").Value;
                    valveComboBox.SelectedItem  = (string)options.Element("Valve_port_name").Value;
                    FCComboBox.SelectedItem     = (string)options.Element("FC_port_name").Value;
                }
                catch (Exception e)
                {
                    MessageBox.Show("Couldn't load default options.", "Default options error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #2
0
        ////////////////////////////////////////////////////////////////////////
        // Initialization
        ////////////////////////////////////////////////////////////////////////

        public Form1()
        {
            InitializeComponent();

            // initialize logger
            logger.setTextBox(textBoxEventLog);

            // get handle to OmniDriver and SPAM
            wrapper = new OmniDriver.NETWrapper();

            // tooltips
            toolTip1.SetToolTip(checkBoxEnableDataCollection, "Save acquisitions to a CSV file");
            toolTip1.SetToolTip(numericUpDownMaxScans, "Stop acquisition after this many scans (0 = run forever)");
            toolTip1.SetToolTip(checkBoxSaveAll, "Save EVERY acquisition (buffers in memory first, will crash if run too long)");

            // timer to drive the graph (often at a lower rate than acquisitions)
            graphTimer          = new System.Windows.Forms.Timer();
            graphTimer.Interval = 100; // update graph at 10Hz
            graphTimer.Tick    += graphTimer_Tick;

            saveTimer          = new System.Windows.Forms.Timer();
            saveTimer.Interval = 1000; // save 1Hz
            saveTimer.Tick    += saveTimer_Tick;
            numericUpDownSaveEverySec.Value = saveTimer.Interval / 1000;

            initializeSpectrometers();
            updateSpectrometersFromGUI();
        }
Пример #3
0
 public MainWindow()
 {
     InitializeComponent();
     widmo.Series[0].Points.DataBindY(Spectrometer.GetDefaultData());
     frequencyTextBox.Text   = "1";
     commandsTextBox.Enabled = false;
     wrapper = new OmniDriver.NETWrapper();
 }
Пример #4
0
 public Spectrometer(ref OmniDriver.NETWrapper _wrapper, int _specIndex, int _integrTime, int _average, int _Boxcar)
 {
     wrapper    = _wrapper;
     integrTime = _integrTime;
     average    = _average;
     boxcar     = _Boxcar;
     index      = _specIndex;
     //w microsekundach
     wrapper.setIntegrationTime(index, integrTime * 1000);
     wrapper.setScansToAverage(index, average);
     wrapper.setBoxcarWidth(index, boxcar);
 }