拨打电话在Windows 10移动电话中

时间:2015-12-25 08:45:18

标签: c# windows-phone

我为Windows 10 Mobile编写应用程序

当我点击按钮时,我需要拨打电话任务。

我尝试这样做

 private void TelephoneButton_Click(object sender, RoutedEventArgs e)
    {
        var phoneCallTask = new PhoneCallTask
        {
            PhoneNumber = "+380442308888",
            DisplayName = "The Name goes here"
        };

        phoneCallTask.Show();

    }

并使用此using Microsoft.Phone.Tasks;

但是在使用 Error CS0234 The type or namespace name 'Phone' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

时出现此错误

,这在PhoneCallTask

Error   CS0246  The type or namespace name 'PhoneCallTask' could not be found (are you missing a using directive or an assembly reference?)

出了什么问题以及如何拨打电话任务?

1 个答案:

答案 0 :(得分:1)

您需要使用PhoneCallManagerWindows.Foundation.UniversalApiContract需要参考。

然后你可以这样做:

private void TelephoneButton_Click(object sender, RoutedEventArgs e)
{
    Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI("+380442308888", "The Name goes here");
}

更新添加引用 enter image description here