Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在wpf中使用SystemInformation.PowerStatus?_C#_Windows - Fatal编程技术网

C# 如何在wpf中使用SystemInformation.PowerStatus?

C# 如何在wpf中使用SystemInformation.PowerStatus?,c#,windows,C#,Windows,使用visual studio 2019,我尝试添加对WindowsFormsIntegration.dll的引用,然后在顶部键入导入,但不确定要使用它还需要做什么。 如线程中所示,我在第二个答案中没有“Assemblies”选项Addusingforms=System.Windows.Forms并向程序集添加引用。我建议使用表单…,因为否则多个类/enum/etc将有冲突的名称(例如,MessageBox/FlowDirection等)。请注意,您也可以使用WMI类。@Jimi Awesome

使用visual studio 2019,我尝试添加对WindowsFormsIntegration.dll的引用,然后在顶部键入导入,但不确定要使用它还需要做什么。
如线程中所示,我在第二个答案中没有“Assemblies”选项

Add
usingforms=System.Windows.Forms并向程序集添加引用。我建议
使用表单…
,因为否则多个类/enum/etc将有冲突的名称(例如,MessageBox/FlowDirection等)。请注意,您也可以使用WMI类。@Jimi Awesome!我试试看,谢谢:)