我有一个功能有一个记录按钮
protected void StartRecord(object sender, RoutedEventArgs e)
{
MessageBox.Show("Start Recording");
//string generatedName = Guid.NewGuid().ToString();
string generatedName = @"c:\Desktop\Stream.recorded";
//recordStreamPathAndName = @"C:" + generatedName + ".recorded";
//this.recordStream = File.Create(recordStreamPathAndName);
this.recordStream = File.Create(generatedName);
this.Recorder = new KinectRecorder(KinectRecordOptions.Color | KinectRecordOptions.Skeletons, recordStream);
}
此代码是否允许我创建记录按钮?如果确实如此,我如何创建它以显示在主窗口上并实际开始录制?在这里回答:这是 .xaml 代码
<Button Click ="StartRecord" DataContext="{Binding}" Name="StartRecording" Width="50" Height="50" Canvas.Left="709" Canvas.Top="0" />
更新:创建按钮并创建文件。但是没有任何东西保存到文件中。
void sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
{
// some stuff
using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
{
if (skeletonFrame == null)
{
return;
}
// Start recorder
this.StartRecord(sender, e);
// parameter asks for (object, Routedeventargs)
// but I have only (object, AllFramesReadyargs) declared in this function.
// some stuff here
}
}