【发布时间】:2017-12-22 18:40:45
【问题描述】:
问题
学习 Xamarin 大学课程 XAM120。在将我的 IDial 实现添加到我的 UWP 项目时遇到了障碍。出于某种原因,我的项目没有在我的系统上使用 PhoneCallManager API。
错误:
错误 CS1069
在命名空间“Windows.ApplicationModel.Calls”中找不到类型名称“PhoneCallManager”。此类型已转发到程序集“Windows.Foundation.UniversalApiContract, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime” 考虑添加对该程序集的引用。
代码:
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 xamarin.forms window xamarin.uwp