如何拨打C#windows universal 10中的号码

时间:2015-09-04 11:26:05

标签: c# windows win-universal-app

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 dev网络中有一个PhoneCallManager类 https://msdn.microsoft.com/en-us/library/windows.applicationmodel.calls.phonecallmanager.aspx

但是当我添加Windows.ApplicationModel.Calls;我无法使用PhoneCallManager,因为没有任何电话管理员..

我激活了电话功能。

Visual Studio 2015 Windows通用APP C# XAML 感谢

1 个答案:

答案 0 :(得分:12)

正如您的错误所述:

  

在命名空间PhoneCallManager中找不到类型名称Windows.ApplicationModel.Calls。此类型已转发到程序集Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime。考虑添加对该程序集的引用。

因此,您需要向程序集MSDN: How to: Add or Remove References By Using the Add Reference Dialog Box添加引用(请参阅Windows.Foundation.UniversalApiContract)。

如果您在网上搜索"请考虑添加引用...",you will find您需要引用Windows 10 SDK,而不是Windows Phone 8.1 SDK。

您需要为此程序集添加的引用位于" Universal Windows" - > "扩展"并被称为" UWP的Windows Mobile Extensions"。

相关问题