private void btnPhoneCall_Click(object sender, RoutedEventArgs e)
{
Microsoft.Phone.Tasks.PhoneCallTask task = new Microsoft.Phone.Tasks.PhoneCallTask();
task.DisplayName = "张三";
task.PhoneNumber = "1234567892";
task.Show();
{
Microsoft.Phone.Tasks.PhoneCallTask task = new Microsoft.Phone.Tasks.PhoneCallTask();
task.DisplayName = "张三";
task.PhoneNumber = "1234567892";
task.Show();
}
在模拟器中运行报错误异常信息,如下图所示:
错误原因:
看异常类型是未授权的访问,应该是你没有在WMAppManifest.xml 中添加要求权限
解决办法:
在项目中找到WMAppManifest.xml文件,选择”功能“,勾选”ID_CAP_PhoneDialer“,保存,然后运行即可。