简体   繁体   English

c# 通用 Windows 控制台应用程序,相机错误“必须初始化此 object...”

[英]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.

相关问题 C#将通用Windows应用程序转换为异步 - c# converting universal windows app to async 在Windows Universal App中使用C#在XAML中着墨 - Inking in XAML with C# in a Windows Universal App Windows Universal App是否具有C#和CSS? - Windows Universal App with C# & CSS? 使用C#中的通用Windows应用程序进行图像编辑 - Image editing with universal windows app in C# 在通用Windows应用程序(c#)中复制对象 - Copy an object in universal Windows Application (c#) 将SQLite Windows窗体应用程序迁移到通用Windows应用程序(C#) - Migrate SQLite windows forms app to universal windows app (C#) 如何从C#查找Windows Universal应用程序窗口 - How to find Windows Universal app windows from C# WinRT ListView,将itemsource作为列表 <KeyValuePair<string, string> &gt;错误XAML(Windows 8.1通用应用程序(XAML / C#)) - WinRT ListView with itemsource as List<KeyValuePair<string, string>> error XAML (Windows 8.1 Universal App (XAML/C#)) 在Windows 10 C#UWP通用Windows应用程序中获取UserName - Get UserName in a Windows 10 C# UWP Universal Windows app 在Windows Universal App中调用默认相机应用 - Call default camera app in Windows Universal App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM