Example #1
0
        private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;

            int dataLength = serialPort1.BytesToRead;

            byte[] data        = new byte[dataLength];
            int    nbrDataRead = serialPort1.Read(data, 0, dataLength);

            if (nbrDataRead == 0)
            {
                return;
            }
            // add to buffer ...
            for (int i = 0; i < data.Length; i++)
            {
                Buffer.Add(data[i]);
            }

            // parse the buffer ...
            ParseBuffer();

            //if(!serialPort1.IsOpen)
            if (termina)
            {
                MessageBox.Show("Inicio del registro en db de los datos");
                BL.saveSampleData(signal_type, _item.Id, SampleDataList);
                MessageBox.Show("Registro guardado correctamente");
                SampleList = BL.getsignals_persons(_item.Id);
                grafico v = new grafico(BL.getDatasamplesLast(), BL.getsignal_typeString(signal_type));
                termina = false;
                v.ShowDialog();
            }
        }
Example #2
0
        private void Dg_samples_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row    = dg_samples.Rows[e.RowIndex];
            signals_persons i      = (signals_persons)row.DataBoundItem;
            sample          sample = BL.getSample(i.id);
            grafico         v      = new grafico(BL.getDatasamples(i.id), BL.getsignal_typeString(sample.signal_type));

            v.ShowDialog();
        }