Ejemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     widmo.Series[0].Points.DataBindY(Spectrometer.GetDefaultData());
     frequencyTextBox.Text   = "1";
     commandsTextBox.Enabled = false;
     wrapper = new OmniDriver.NETWrapper();
 }
Ejemplo n.º 2
0
        private void ButtonStart_Click(object sender, EventArgs e)
        {
            string errorMsg = "";

            if (!fileChosen)
            {
                errorMsg += "Choose an output file." + Environment.NewLine;
            }
            if (!commandsLoaded)
            {
                errorMsg += "Commands were not loaded." + Environment.NewLine;
            }
            if (!spectChosen)
            {
                errorMsg += "Spectromenter is not configured." + Environment.NewLine;
            }
            if (!(fileChosen & commandsLoaded & spectChosen))
            {
                var msgbox = MessageBox.Show("Unable to start: " + Environment.NewLine + Environment.NewLine + errorMsg, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (data != null)
            {
                data.Clear();
            }
            valvesCon    = new ValvesController(ValvePortName);
            flowCon      = new FlowController(FCPortName);
            spectrometer = new Spectrometer(ref wrapper, specIndex, specIntegrTime, specAverage, specBoxcar);
            //clear the file
            File.Create(filePath).Close();
            eofStream = File.AppendText(filePath);
            eofStream.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<eksperymenty>" + Environment.NewLine + "<komentarz>"
                            + Environment.NewLine + commentTextBox.Text + "</komentarz> ");

            data        = new ArrayList();
            timeSum     = 0;
            elapsedTime = 0;
            expNumber   = 0;

            ProgressLabel.Visible    = true;
            ExpNumberLabel.Visible   = true;
            frequencyTextBox.Enabled = false;
            timer.Interval           = frequency * 1000;

            foreach (int[] commandLine in commands)
            {
                timeSum += commandLine[0];
            }

            singleExpTime = 0;
            this.ApplyCommands(0);
            dateOfStart   = DateTime.Now;
            timer.Enabled = true;
        }