0

这是一个非常简单的任务,但不知何故它失败了......

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

堆栈跟踪: 在 Microsoft.Phone.Tasks.PhoneCallTask​​.NativeMethods.PhoneInitiateOutgoingPhoneCall_External(String pDialString, String pDisplayName)

在 Microsoft.Phone.Tasks.PhoneCallTask​​.PhoneDial(对象 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();
4

1 回答 1

6

您可能没有在应用清单文件中指定以下权限:

ID_CAP_PHONEDIALER
于 2013-07-10T08:10:09.767 回答