PhoneLine.FromIdAsync(Guid) 方法

定义

此静态方法根据线路 ID 异步检索表示设备上特定电话线路的 PhoneLine 对象。

public:
 static IAsyncOperation<PhoneLine ^> ^ FromIdAsync(Platform::Guid lineId);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<PhoneLine> FromIdAsync(winrt::guid const& lineId);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<PhoneLine> FromIdAsync(Guid lineId);
function fromIdAsync(lineId)
Public Shared Function FromIdAsync (lineId As Guid) As IAsyncOperation(Of PhoneLine)

参数

lineId
Guid

Platform::Guid

winrt::guid

要检索的电话线路的线路 ID。

返回

一个异步操作,它返回一个 PhoneLine 对象,该对象基于线路 ID 表示设备上的特定电话线。 失败时,它将引发异常。

属性

Windows 要求

应用功能
phoneCallHistory phoneCallHistorySystem

注解

以下示例演示如何获取默认的 PhoneLine

private async Task<PhoneLine> GetDefaultPhoneLineAsync()
{
    PhoneCallStore phoneCallStore = await PhoneCallManager.RequestStoreAsync();
    Guid lineId = await phoneCallStore.GetDefaultLineAsync();
    PhoneLine line = null;
    try
    {
        line = await PhoneLine.FromIdAsync(lineId);
    }
    catch (Exception ex)
    {
        Logger.Instance.LogErrorMessage($"PhoneLine.FromIdAsync failed:{ex.Message}");
    }
return line;
}

适用于