当前位置: 首页>>代码示例>>C#>>正文


C# DataPackage.SetUri方法代码示例

本文整理汇总了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);
        }
开发者ID:tallichet,项目名称:ShareIt,代码行数:8,代码来源:ShareTarget.xaml.cs

示例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);
		}
开发者ID:slodge,项目名称:Charmed,代码行数:19,代码来源:Win8FeedItemViewModel.cs

示例3: ShareUrl

 private void ShareUrl(DataPackage dataPackage, string url)
 {
     Uri uri = new Uri(url);
     dataPackage.SetUri(uri);
 }
开发者ID:derikwhittaker,项目名称:LiveLessons.WinRT,代码行数:5,代码来源:DashboardPage.xaml.cs

示例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;
        }
开发者ID:eduavila,项目名称:Win8AppTERA,代码行数:51,代码来源:ItemPage.xaml.cs

示例5: ShareUrl

 private void ShareUrl(DataPackage dataPackage, string url)
 {
     dataPackage.SetUri(new Uri(url));
 }
开发者ID:derikwhittaker,项目名称:LiveLessons.WinRT,代码行数:4,代码来源:DashboardPage.xaml.cs


注:本文中的Windows.ApplicationModel.DataTransfer.DataPackage.SetUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。