[英]c# Universal Windows console App, Camera error "This object must be initialised... "
When I start debugging a Universal Windows console application and initialise the camera I get the following error.当我开始调试通用 Windows 控制台应用程序并初始化相机时,出现以下错误。
When excute this line: (I execute it in Program.Main )执行此行时:(我在 Program.Main 中执行)
await mediaCapture.InitializeAsync(captureInitSettings);
See error: "This object must be initialised in order to perform the requested operation."请参阅错误:“必须初始化此 object 才能执行请求的操作。”
When I use a normal Universal Windows application it works correctly but in console show error..当我使用普通的 Universal Windows 应用程序时,它可以正常工作,但在控制台中显示错误..
Here I have 2 questions.在这里我有两个问题。
Why do I get an error in the console app?为什么我在控制台应用程序中收到错误消息?
and和
In case of not being able to use a console application, could I use a normal Universal Windows application by passing parameters to it or will it give me an error in a linux because it does not have a graphical interface?如果无法使用控制台应用程序,我可以通过向它传递参数来使用普通的通用 Windows 应用程序,还是因为它没有图形界面而在 linux 中给我一个错误?
Why do I get an error in the console app?
为什么我在控制台应用程序中收到错误消息?
This behavior is expected, the InitializeAsync
should be called from the main UI thread of your app.此行为是预期的,应从应用的主 UI 线程调用
InitializeAsync
。 So you can't call it from a console application.所以你不能从控制台应用程序调用它。
could I use a normal Universal Windows application by passing parameters to it or will it give me an error in a linux because it does not have a graphical interface?
我可以通过向它传递参数来使用普通的通用 Windows 应用程序,还是因为它没有图形界面而在 linux 中给我一个错误?
No, you can't run a normal UWP in linux without a graphical interface.不行,没有图形界面你不能在linux中运行一个正常的UWP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.