DataPackageView.GetTextAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
GetTextAsync(String) |
获取 DataPackageView 对象中的文本。 |
GetTextAsync() |
获取 DataPackageView 对象中的文本。 |
GetTextAsync(String)
获取 DataPackageView 对象中的文本。
public:
virtual IAsyncOperation<Platform::String ^> ^ GetTextAsync(Platform::String ^ formatId) = GetTextAsync;
/// [Windows.Foundation.Metadata.Overload("GetCustomTextAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<winrt::hstring> GetTextAsync(winrt::hstring const& formatId);
[Windows.Foundation.Metadata.Overload("GetCustomTextAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<string> GetTextAsync(string formatId);
function getTextAsync(formatId)
Public Function GetTextAsync (formatId As String) As IAsyncOperation(Of String)
参数
- formatId
-
String
Platform::String
winrt::hstring
表示数据格式的字符串。 通常 为 StandardDataFormats.Text。
返回
所请求格式的文本。
- 属性
另请参阅
适用于
GetTextAsync()
获取 DataPackageView 对象中的文本。
public:
virtual IAsyncOperation<Platform::String ^> ^ GetTextAsync() = GetTextAsync;
/// [Windows.Foundation.Metadata.Overload("GetTextAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<winrt::hstring> GetTextAsync();
[Windows.Foundation.Metadata.Overload("GetTextAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<string> GetTextAsync();
function getTextAsync()
Public Function GetTextAsync () As IAsyncOperation(Of String)
返回
文本。
- 属性
示例
ShareOperation shareOperation = args.ShareOperation;
if (shareOperation.Data.Contains(StandardDataFormats.Text))
{
string text = await shareOperation.Data.GetTextAsync();
// To output the text from this example, you need a TextBlock control
// with a name of "sharedContent".
sharedContent.Text = "Text: " + text;
}
var shareOperation = eventObject.detail.shareOperation;
if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
shareOperation.data.getTextAsync().done(function (text) {
// To output the text using this example,
// you need a div tag with an id of "output" in your HTML file.
document.getElementById("output").innerText = text;
}, function (e) {
displayError("Error retrieving Text format: " + e);
}
});
}