コード例 #1
0
 /// <summary>
 /// Adds the active Curve to the active SimpleMeasurement and casts BeginReceiveCurve events coming from a different thread to the UI thread when necessary.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="CurveEventArgs"/> instance containing the event data.</param>
 /// <exception cref="System.NullReferenceException">Platform not set.</exception>
 private void _comm_BeginReceiveCurve(object sender, CurveEventArgs e)
 {
     if (_platform == null)
     {
         throw new NullReferenceException("Platform not set.");
     }
     if (_platform.InvokeIfRequired(new CurveEventHandler(_comm_BeginReceiveCurve), sender, e)) //Recast event to UI thread when necessary
     {
         return;
     }
     OnSimpleCurveStartReceivingData(e.GetCurve());
 }
コード例 #2
0
        private void HW_BeginReceiveCurve(object sender, CurveEventArgs e)
        {
            log.Add("New curve received");

            Curve curve = e.GetCurve();

            resultCurves.Add(curve);

            double[] xVals   = curve.GetXValues();
            double[] yVals   = curve.GetYValues();
            bool     bUpdate = false;

            curves.Add(curve);

            if (curve.YAxisDataArray.ArrayType != (int)DataArrayType.ExtraValue) //Check if curve contains Bipot (WE2) data
            {
                experimentData.data.Add(new double[2][] { xVals, yVals });

                experimentData.axisNames.Add(new string[] { "Time", "Current" });
                experimentData.axisUnits.Add(new string[] { curve.XUnit.ToString(), curve.YUnit.ToString() });
                experimentData.datasetNames.Add("WE");
            }
            else
            {
                experimentData.data.Add(new double[2][] { xVals, yVals });

                experimentData.axisNames.Add(new string[] { "Time", "AUX Current" });
                experimentData.axisUnits.Add(new string[] { curve.XUnit.ToString(), curve.YUnit.ToString() });
                experimentData.datasetNames.Add("AUX");

                bUpdate = true;
            }

            e.GetCurve().NewDataAdded -= HW_NewDataAdded;
            e.GetCurve().NewDataAdded += HW_NewDataAdded;

            NotifyExperimentDataUpdatedNow(new ExperimentDataEventArgs(experimentData, bUpdate));
        }
コード例 #3
0
 //Notifies when a curve begins to receive data from the potentiostat
 protected virtual void Comm_BeginReceiveCurve(object sender, CurveEventArgs e)
 {
     _activeCurve = e.GetCurve();
     _activeCurve.NewDataAdded += _activeCurve_NewDataAdded;
     _activeCurve.Finished     += _activeCurve_Finished;
 }