如何在C#中拨号windows universal 10

How to dial a Number in C# windows universal 10

Hy在win8下可以

using Microsoft.Phone.Tasks;
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = "2065550123";
phoneCallTask.DisplayName = "Gage";
phoneCallTask.Show();

但在 Win 10 通用应用程序中你必须使用

Windows.ApplicationModel.Calls;
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(PhoneNumber, DisplayName);

并且在 msdn 开发网络中有一个 PhoneCallManager Class https://msdn.microsoft.com/en-us/library/windows.applicationmodel.calls.phonecallmanager.aspx

但是当我添加 Windows.ApplicationModel.Calls;我不能使用 PhoneCallManager 因为没有任何呼叫管理器..

我激活了 Phone 呼叫功能。

Visual Studio 2015 年 Windows万能APP C# XAML 谢谢

如您的错误所述:

The type name PhoneCallManager could not be found in the namespace Windows.ApplicationModel.Calls. This type has been forwarded to assembly Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime. Consider adding a reference to that assembly.

所以你需要添加一个引用(参见MSDN: How to: Add or Remove References By Using the Add Reference Dialog Box) to the assembly Windows.Foundation.UniversalApiContract

如果您在网上搜索 "consider adding a reference..."、you will find,您需要参考 Windows 10 SDK,而不是 Windows Phone 8.1 SDK .

您需要为该程序集添加的引用位于 "Universal Windows" -> "Extensions" 下,名为 "Windows Mobile Extensions for the UWP"。