本文整理汇总了C#中Windows.ApplicationModel.DataTransfer.DataPackage.SetUri方法的典型用法代码示例。如果您正苦于以下问题:C# DataPackage.SetUri方法的具体用法?C# DataPackage.SetUri怎么用?C# DataPackage.SetUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.ApplicationModel.DataTransfer.DataPackage
的用法示例。
在下文中一共展示了DataPackage.SetUri方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyToClipBoard
private void CopyToClipBoard(object sender, RoutedEventArgs e)
{
var content = new DataPackage();
content.SetUri(new Uri(textboxLink.Text));
content.SetText(textboxLink.Text);
Clipboard.SetContent(content);
}
示例2: ShareRequested
private void ShareRequested(DataPackage dataPackage)
{
// Set as many data types as we can.
dataPackage.Properties.Title = this.FeedItem.Title;
// Add a Uri
dataPackage.SetUri(this.FeedItem.Link);
// Add a text only version
var text = string.Format("Check this out! {0} ({1})", this.FeedItem.Title, this.FeedItem.Link);
dataPackage.SetText(text);
// Add an HTML version.
var htmlBuilder = new StringBuilder();
htmlBuilder.AppendFormat("<p>Check this out!</p>", this.FeedItem.Author);
htmlBuilder.AppendFormat("<p><a href='{0}'>{1}</a></p>", this.FeedItem.Link, this.FeedItem.Title);
var html = HtmlFormatHelper.CreateHtmlFormat(htmlBuilder.ToString());
dataPackage.SetHtmlFormat(html);
}
示例3: ShareUrl
private void ShareUrl(DataPackage dataPackage, string url)
{
Uri uri = new Uri(url);
dataPackage.SetUri(uri);
}
示例4: GetShareContent
private bool GetShareContent(DataRequest request)
{
bool succeeded = false;
if (this.flipView.SelectedItem != null)
{
var item = (Item)this.flipView.SelectedItem;
// string customData = @"{
// ""type"" : ""http://schema.org/Product"",
// ""properties"" :
// {
// ""url"" : ""#URL#"",
// ""description"" : ""#DESC#"",
// ""name"" : ""#NAME#"",
// ""model"" : ""#MODEL#"",
// ""price"" : ""#PRICE#""
// }
// }";
// customData = customData.Replace("#URL#", item.Uri).Replace("#DESC#", item.Descricao).Replace("#NAME#", item.Nome).Replace("#MODEL#", item.Categoria.Nome).Replace("#PRICE#", "R$ " + item.Valor);
requestData = request.Data;
//requestData.SetData("http://schema.org/Product", customData);
requestData.Properties.Title = item.Nome == null ? "Imagem compartilhada" : item.Nome;
requestData.Properties.Description = item.Descricao;
RandomAccessStreamReference imageStreamRef = null;
imageStreamRef = RandomAccessStreamReference.CreateFromUri(new Uri(_baseUri, item.ImageUrl));
if (imageStreamRef != null)
{
requestData.SetUri(new Uri(_baseUri, item.ImageUrl));
requestData.Properties.Title = string.Format("{0} - {1}", Win8CatalogApplication.Instance.Empresa.Nome, item.Nome);
requestData.Properties.Description = item.Descricao;
requestData.SetText(item.Descricao);
requestData.Properties.Thumbnail = imageStreamRef;
requestData.SetBitmap(imageStreamRef);
succeeded = true;
}
}
else
{
request.FailWithDisplayText("Selecione a imagem que deseja compartilhar e tente novamente.");
}
return succeeded;
}
示例5: ShareUrl
private void ShareUrl(DataPackage dataPackage, string url)
{
dataPackage.SetUri(new Uri(url));
}