做了很多环顾四周,我找不到任何解决方案。
- 目标:让我的 Windows 8.1 平板电脑上的相机闪光灯 LED 闪烁。使用Windows 8.1和VS2013进行开发。
- InitializeAsync 方法允许应用程序使用默认设置初始化相机和麦克风
- 我将该应用程序构建为 Windows 应用商店应用程序,它运行完美。
- 我需要该文件是可执行文件,并且需要将其转换为控制台应用程序
- 当我执行 mc.InitializeAsync “错误 1 'await' 要求类型 'Windows.Foundation.IAsyncAction' 具有合适的 GetAwaiter 方法时,我收到以下错误。您是否缺少 'System' 的 using 指令?c:\users\列维\文档\视觉工作室 2013\项目\ledblinkerconsole\ledblinkerconsole\torch.cs 16 14 LEDBlinkerConsole
- 我不知道如何通过控制台应用程序初始化相机
- 非常感谢任何其他闪烁 LED 闪光灯的方法。尽管在 C++ 中执行此操作,但我无权访问内存位置。
多谢你们!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Media.Devices;
using Windows.Media.Capture;
namespace LEDBlinkerConsole
{
class Torch
{
public async static void BlinkLED()
{
MediaCapture mc = new MediaCapture();
await mc.InitializeAsync();
Console.WriteLine("Please type \"flash\" to flash the LED\n");
string consInput = Console.ReadLine();
if (consInput.ToUpper() == "FLASH")
{
if (mc.VideoDeviceController.TorchControl.Supported == true)
{
mc.VideoDeviceController.TorchControl.Enabled = true;
mc.VideoDeviceController.TorchControl.PowerPercent = 100;
}
}
}
}
}