简体   繁体   中英

How to dial a Number in C# windows universal 10

Hy in win8 you can

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

but in Win 10 universal apps you have to use

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

and in the msdn dev network there is a PhoneCallManager Class https://msdn.microsoft.com/en-us/library/windows.applicationmodel.calls.phonecallmanager.aspx

But when i add the Windows.ApplicationModel.Calls; i can't use the PhoneCallManager because there isn't any callmanager..

I activated the Phone Call Capabilities.

Visual Studio 2015 Windows Universal APP c# XAML Thanks

As your error states:

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.

So you need to add a reference (see MSDN: How to: Add or Remove References By Using the Add Reference Dialog Box ) to the assembly Windows.Foundation.UniversalApiContract .

If you search the web for the "consider adding a reference...", you will find you need to reference the Windows 10 SDK, not the Windows Phone 8.1 SDK.

The reference you need to add for this assembly is under "Universal Windows" -> "Extensions" and is called "Windows Mobile Extensions for the UWP".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM