问题
学习 Xamarin 大学类(class) XAM120 。在将我的 IDial
实现添加到我的 UWP 项目时遇到了阻碍。由于某种原因,我的项目没有在我的系统上获取 PhoneCallManager
API。
错误:
Error CS1069
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=3.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly.
代码:
using System.Threading.Tasks;
using Windows.Foundation.Metadata;
using Phoneword.UWP;
using Xamarin.Forms;
namespace Phoneword.UWP
{
public class PhoneDialer : IDialer
{
public Task<bool> DialAsync(string phoneNumber)
{
if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0))
{
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(phoneNumber, "Phoneword");
return Task.FromResult(true);
}
return Task.FromResult(false);
}
}
}
最佳答案
关于c# - Xamarin Forms UWP 丢失电话调用管理器程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45157576/