这是一项非常简单的任务,但不知怎的,它失败了......
private void TextBlock_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
{
if (WasSwipe != true)
{
//JUST TO CHECK THAT CODE GETS HERE - RUNS PERFECT
MessageBox.Show("");
//FUNCTION
var phoneCallTask = new PhoneCallTask
{
DisplayName = "Kunal Chowdhury",
PhoneNumber = "0208795446322"
};
phoneCallTask.Show();
//FAILS HERE, AFTER SHOW
}
else
{
WasSwipe = false;
}
}
当我想显示任务时,它失败了:
消息:访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))
来源: Microsoft.Phone
Stack-trace: at Microsoft.Phone.Tasks.PhoneCallTask.NativeMethods.PhoneInitiateOutgoingPhoneCall_External(String pDialString,String pDisplayName)
at Microsoft.Phone.Tasks.PhoneCallTask.PhoneDial(Object phoneCallTask)
在 System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(对象 状态)
在System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback回调,对象状态,布尔值 preserveSyncCtx)
在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态,布尔值 preserveSyncCtx)
在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
在System.Threading.ThreadPoolWorkQueue.Dispatch()
在System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
另外:
电子邮件任务有效:
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.Subject = "message subject";
emailComposeTask.Body = "message body";
emailComposeTask.To = "recipient@example.com";
emailComposeTask.Cc = "cc@example.com";
emailComposeTask.Bcc = "bcc@example.com";
emailComposeTask.Show();