/// <summary>
        /// Called when a new alpha value is received from the device. Updates the
        /// chart with the new value.
        /// </summary>
        /// <param name="sender">The <see cref="ReadEEG"/> object that raised this
        /// event.</param>
        /// <param name="e">The <see cref="AlphaReceivedEventArgs"/> that contains
        /// the new alpha value.</param>
        private void _readEEG_AlphaReceived(object sender, EventArgs e)
        {
            AlphaReceivedEventArgs alphaReceived = (AlphaReceivedEventArgs)e;

            // Add the new alpha reading to our ChartValues.
            ChartValues.Add(
                new EEGPowerAlphaValue(
                    DateTime.Now,
                    alphaReceived.Alpha));

            // Update the chart limits.
            SetAxisLimits(DateTime.Now);

            // Lets only use the last 30 values. You may want to adjust this.
            if (ChartValues.Count > 30)
            {
                ChartValues.RemoveAt(0);
            }
        }
Exemple #2
0
 /// <summary>
 /// Raises the <see cref="AlphaReceived"/> event if there is a subscriber.
 /// </summary>
 /// <param name="e">Contains the new alpha value.</param>
 protected virtual void OnAlphaReceived(AlphaReceivedEventArgs e)
 {
     AlphaReceived?.Invoke(this, e);
 }