本文整理汇总了C#中AllFramesReadyEventArgs.OpenFrame方法的典型用法代码示例。如果您正苦于以下问题:C# AllFramesReadyEventArgs.OpenFrame方法的具体用法?C# AllFramesReadyEventArgs.OpenFrame怎么用?C# AllFramesReadyEventArgs.OpenFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AllFramesReadyEventArgs
的用法示例。
在下文中一共展示了AllFramesReadyEventArgs.OpenFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyAllFramesReadyEventHandler
//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);
}
}
}
示例2: MyAllFramesReadyEventHandler
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());
}
}