/// <summary> /// If new Data is availible to Draw/Plot/... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void NewDataRecieved(object sender, NewDataAvailableEvent e) { if (this.InvokeRequired) { // Using this.Invoke causes deadlock when closing serial port, and BeginInvoke is good practice anyway. this.BeginInvoke(new EventHandler <NewDataAvailableEvent>(NewDataRecieved), new object[] { sender, e }); return; } //Update Graphs zGraph.UpdateZedGraph(zedGraphAudio, e.audio, counter * e.audio.Length); spec.DrawSpectrogram(e.FFT, counter); act.DrawActivity((int)rand.Next(Statics.max_act + 1)); act.DrawActivity(e.activity); pos.DrawPosition(e.sleepPosition); sno.DrawPosition(e.snore); if (counter < Statics.num_of_lines - 1) { counter++; if ((counter % (int)(Statics.FS / Statics.FFTSize)) == 0) { rec_logo = !rec_logo; Change_Rec_logo(); } } else { counter = 0; //pos.DrawPosition((int)rand.Next(3)); } }
/// <summary> /// If new Data is availible to Draw/Plot/... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void NewDataRecieved(object sender, NewDataAvailableEvent e) { if (this.InvokeRequired) { // Using this.Invoke causes deadlock when closing serial port, and BeginInvoke is good practice anyway. this.BeginInvoke(new EventHandler<NewDataAvailableEvent>(NewDataRecieved), new object[] { sender, e }); return; } //Update Graphs zGraph.UpdateZedGraph(zedGraphAudio,e.audio,counter*e.audio.Length); spec.DrawSpectrogram(e.FFT, counter); act.DrawActivity((int)rand.Next(Statics.max_act+1)); act.DrawActivity(e.activity); pos.DrawPosition(e.sleepPosition); sno.DrawPosition(e.snore); if (counter < Statics.num_of_lines - 1) { counter++; if ((counter % (int)(Statics.FS / Statics.FFTSize)) == 0) { rec_logo = !rec_logo; Change_Rec_logo(); } } else { counter = 0; //pos.DrawPosition((int)rand.Next(3)); } }