在 Windows 10 手机中拨打 phone 电话
Make a phone call In Windows 10 mobile
我正在为 Windows 10 Mobile
编写应用程序
我需要在点击按钮时调用 Phone 任务。
我试着这样做
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?)
有什么问题以及如何调用 Phone 任务?
您需要使用PhoneCallManager. A reference is needed to Windows.Foundation.UniversalApiContract。
那么你可以这样做:
private void TelephoneButton_Click(object sender, RoutedEventArgs e)
{
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI("+380442308888", "The Name goes here");
}
更新添加参考
我正在为 Windows 10 Mobile
编写应用程序我需要在点击按钮时调用 Phone 任务。
我试着这样做
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?)
有什么问题以及如何调用 Phone 任务?
您需要使用PhoneCallManager. A reference is needed to Windows.Foundation.UniversalApiContract。
那么你可以这样做:
private void TelephoneButton_Click(object sender, RoutedEventArgs e)
{
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI("+380442308888", "The Name goes here");
}
更新添加参考