I am using Kinect.Toolbox in my project, i need to show a message after the replay ends. Is there a way to get this moment?
actualy my code do the following
Stream recordStream = File.OpenRead(@"D:\recorded.FisioKinect");
this.Replay = new KinectReplay(recordStream);
this.Replay.ColorImageFrameReady += replay_ColorImageFrameReady;
this.Replay.Start();
and the replay_ColorImageFrameReady is here
void replay_ColorImageFrameReady(object sender, ReplayColorImageFrameReadyEventArgs e)
{
if (this.Replay.IsFinished)
{
MessageBox.Show("End");
}
byte[] pixelData = new byte[e.ColorImageFrame.PixelDataLength];
e.ColorImageFrame.CopyPixelDataTo(pixelData);
// Other awesome stuff :)
}
Note that the Replay object have a property called IsFinished, but the replay_ColorImageFrameReady will not be raised if the Replay IsFinished, so, the message never will be shown.
The code of Kinect.Toolbox uses TPL and i dont know so much about TPL, i want to change the code of the Kinect.Toolbox to fire an event like OnReplayEnd
You can build a structure like this:
In your KinectReplay.cs
add
and trigger it wherever you want to use it.