Windows 10:如何创建电话线class?

Windows 10: How do you create a PhoneLine class?

我想以编程方式用我的 windows phone 10 拨打电话,但是我不知道如何创建电话线 class 谁能告诉我怎么做?

我是 C# 和移动世界的新手。

我在这里找到了 API 参考资料: https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.calls.phoneline

我试图做的是:

new Windows.ApplicationModel.Calls.PhoneLine();

然而我得到的是:

Severity    Code    Description Project File    Line    Suppression State
    Error   CS1069  The type name 'PhoneLine' could not be found in the 
namespace 'Windows.ApplicationModel.Calls'. This type has been forwarded to 
assembly 'Windows.Foundation.UniversalApiContract, Version=3.0.0.0, 
Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider 
adding a reference to that assembly.    App2    C:\documents\visual studio 
2015\Projects\Helloworld2\App2\MainPage.xaml.cs 33  Active

正如错误所说,

This type has been forwarded to assembly 'Windows.Foundation.UniversalApiContract, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly

您需要将Windows.Foundation.UniversalApiContract dll添加到项目中作为参考

如果你仔细阅读错误,你会发现它是这样写的:

"This type has been forwarded to assembly 'Windows.Foundation.UniversalApiContract, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly."

您需要添加对 Windows.Foundation.UniversalApiContract 程序集的引用,因为您要查找的 class 已移到那里。

根据this blog可以在这里找到:

C:\Program Files (x86)\Windows Kits\References\Windows.Foundation.UniversalApiContract.0.0.0\Windows.Foundation.UniversalApiContract.winmd

如果您使用的是 32 位系统,请从路径中删除 (x86)