Beispiel #1
0
 //This is the handler to be given to GeneratorSingleton.Instance.AllFramesReady.
 //In order to easily switch to waiting separately for each stream
 //(GeneratorSingleton.Instance.DataFrameReady and GeneratorSingleton.Instance.ColorImageFrameReady),
 //The issue the following, instead of MyAllFramesReadyEventHandler:
 // GeneratorSingleton.Instance.DataFrameReady += JointsUpdate.MyDataFrameReady;
 // GeneratorSingleton.Instance.ColorImageFrameReady += RgbTextureUpdate.MyColorImageFrameReadyEventHandler;
 private void MyAllFramesReadyEventHandler(object sender, AllFramesReadyEventArgs e)
 {
     using (var allFrames = e.OpenFrame() as AllFramesFrame)
     {
         if (allFrames != null)
         {
             foreach (var evtArgs in allFrames.FramesReadyEventArgs)
             {
                 var colorImageFrameReady = evtArgs as ColorImageFrameReadyEventArgs;
                 if (null != colorImageFrameReady)
                 {
                     this.MyColorImageFrameReadyEventHandler(sender, colorImageFrameReady);
                     continue;
                 }
                 var dataFrameReady = evtArgs as DataFrameReadyEventArgs;
                 if (null != dataFrameReady)
                 {
                     this.MyDataFrameReady(sender, dataFrameReady);
                     continue;
                 }
                 var gestureFrameReady = evtArgs as GesturesFrameReadyEventArgs;
                 if (null != gestureFrameReady)
                 {
                     this.MyRecognitionFrameReadyEventHandler(sender, gestureFrameReady);
                     continue;
                 }
             }
             LogWarnings(allFrames.FrameKey.FrameNumberKey);
         }
     }
 }
 private void MyAllFramesReadyEventHandler(object sender, AllFramesReadyEventArgs e)
 {
     using (var allFrames = e.OpenFrame() as AllFramesFrame)
     {
         if (allFrames != null)
         {
             foreach (var evtArgs in allFrames.FramesReadyEventArgs)
             {
                 if (evtArgs.GetType().Equals(typeof(ColorImageFrameReadyEventArgs)))
                 {
                     HandleColorImageEvent(evtArgs as ColorImageFrameReadyEventArgs);
                 }
                 else
                 {
                     if (evtArgs.GetType().Equals(typeof(GesturesFrameReadyEventArgs)))
                     {
                         HandleGestureEvent(evtArgs as GesturesFrameReadyEventArgs);
                     }
                     else
                     {
                         if (evtArgs.GetType().Equals(typeof(DataFrameReadyEventArgs)))
                         {
                             HandleDataEvent(evtArgs as DataFrameReadyEventArgs);
                         }
                     }
                 }
             }
         }
     }
 }
 private void MyAllFramesReadyEventHandler(object sender, AllFramesReadyEventArgs e)
 {
     try
     {
         using (var allFrames = e.OpenFrame() as AllFramesFrame)
         {
             if (allFrames != null)
             {
                 foreach (var evtArgs in allFrames.FramesReadyEventArgs)
                 {
                     var colorImageFrameReady = evtArgs as ColorImageFrameReadyEventArgs;
                     if ((MyColorImageFrameReadyEventHandler != null) && (null != colorImageFrameReady))
                     {
                         Xtr3dGeneratorStateManager.MyColorImageFrameReadyEventHandler(sender, colorImageFrameReady);
                         continue;
                     }
                     var dataFrameReady = evtArgs as DataFrameReadyEventArgs;
                     if ((MyDataFrameReady != null) && (null != dataFrameReady))
                     {
                         Xtr3dGeneratorStateManager.MyDataFrameReady(sender, dataFrameReady);
                         continue;
                     }
                     var gesturesFrameReady = evtArgs as GesturesFrameReadyEventArgs;
                     if ((MyGesturesFrameReady != null) && (null != gesturesFrameReady))
                     {
                         Xtr3dGeneratorStateManager.MyGesturesFrameReady(sender, gesturesFrameReady);
                         continue;
                     }
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         Debug.LogError("Error in MyAllFramesReadyEventHandler: \n" + ex.ToString());
     }
 }
 //This is the handler to be given to GeneratorSingleton.Instance.AllFramesReady.
 //In order to easily switch to waiting separately for each stream
 //(GeneratorSingleton.Instance.DataFrameReady and GeneratorSingleton.Instance.ColorImageFrameReady),
 //The issue the following, instead of MyAllFramesReadyEventHandler:
 // GeneratorSingleton.Instance.DataFrameReady += JointsUpdate.MyDataFrameReady;
 // GeneratorSingleton.Instance.ColorImageFrameReady += RgbTextureUpdate.MyColorImageFrameReadyEventHandler;
 private void MyAllFramesReadyEventHandler(object sender, AllFramesReadyEventArgs e)
 {
     using (var allFrames = e.OpenFrame() as AllFramesFrame)
     {
         if (allFrames != null)
         {
             foreach (var evtArgs in allFrames.FramesReadyEventArgs)
             {
                 var colorImageFrameReady = evtArgs as ColorImageFrameReadyEventArgs;
                 if (null != colorImageFrameReady)
                 {
                     this.MyColorImageFrameReadyEventHandler(sender, colorImageFrameReady);
                     continue;
                 }
                 var dataFrameReady = evtArgs as DataFrameReadyEventArgs;
                 if (null != dataFrameReady)
                 {
                     this.MyDataFrameReady(sender, dataFrameReady);
                     continue;
                 }
                 var gestureFrameReady = evtArgs as GesturesFrameReadyEventArgs;
                 if (null != gestureFrameReady)
                 {
                     this.MyRecognitionFrameReadyEventHandler(sender, gestureFrameReady);
                     continue;
                 }
             }
             LogWarnings(allFrames.FrameKey.FrameNumberKey);
         }
     }
 }
 private void MyAllFramesReadyEventHandler(object sender, AllFramesReadyEventArgs e)
 {
     try
     {
         using (var allFrames = e.OpenFrame() as AllFramesFrame)
         {
             if (allFrames != null)
             {
                 foreach (var evtArgs in allFrames.FramesReadyEventArgs)
                 {
                     var colorImageFrameReady = evtArgs as ColorImageFrameReadyEventArgs;
                     if ((ExtremeMotionEventsManager.MyColorImageFrameReadyHandler != null) && (null != colorImageFrameReady))
                     {
                         ExtremeMotionEventsManager.MyColorImageFrameReadyHandler(sender, colorImageFrameReady);
                         continue;
                     }
                     var dataFrameReady = evtArgs as DataFrameReadyEventArgs;
                     if ((ExtremeMotionEventsManager.MyDataFrameReadyHandler != null) && (null != dataFrameReady))
                     {
                         ExtremeMotionEventsManager.MyDataFrameReadyHandler(sender, dataFrameReady);
                         continue;
                     }
                     var gesturesFrameReady = evtArgs as GesturesFrameReadyEventArgs;
                     if ((ExtremeMotionEventsManager.MyGesturesFrameReadyHandler != null) && (null != gesturesFrameReady))
                     {
                         ExtremeMotionEventsManager.MyGesturesFrameReadyHandler(sender, gesturesFrameReady);
                         continue;
                     }
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         Debug.LogError("Error in MyAllFramesReadyEventHandler: \n" + ex.ToString());
     }
 }