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


C# DataPackage.SetWebLink方法代码示例

本文整理汇总了C#中Windows.ApplicationModel.DataTransfer.DataPackage.SetWebLink方法的典型用法代码示例。如果您正苦于以下问题:C# DataPackage.SetWebLink方法的具体用法?C# DataPackage.SetWebLink怎么用?C# DataPackage.SetWebLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.ApplicationModel.DataTransfer.DataPackage的用法示例。


在下文中一共展示了DataPackage.SetWebLink方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDataRequested

        private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs e)
        {
            _requestData = e.Request.Data;

            _requestData.Properties.Title = _title;
            _requestData.Properties.Description = _description;
            _requestData.SetWebLink(new Uri(_imageUrl));
        }
开发者ID:oferhaze,项目名称:Ferrari,代码行数:8,代码来源:SharingService.cs

示例2: HandleShareRequested

		partial void HandleShareRequested(string shareLink)
		{
			var dataPackage = new DataPackage();
			dataPackage.SetText(shareLink);
            dataPackage.SetWebLink(new Uri(shareLink));
			Clipboard.SetContent(dataPackage);

			var notificationService = SimpleIoc.Default.GetInstance<NotificationService>();
			notificationService.ShowToast("File shared", "A link has been copied to the clipboard", "Assets/Logo.scale-100.png");

			this.Complete();
		}
开发者ID:viciousviper,项目名称:pCloud.NET,代码行数:12,代码来源:ShareViewModel.cs

示例3: CopyLink

        private async Task CopyLink(File file)
        {
            this.IsLoading = true;
            try
            {
                var link = await this.client.GetPublicFileLinkAsync(file.FileId, null);
                var dataPackage = new DataPackage();
                dataPackage.SetText(link);
                dataPackage.SetWebLink(new Uri(link));
                Clipboard.SetContent(dataPackage);

                var notificationService = SimpleIoc.Default.GetInstance<NotificationService>();
                notificationService.ShowToast("File(s) shared", "A link has been copied to the clipboard", "Assets/Logo.scale-100.png");
            }
            finally
            {
                this.IsLoading = false;
            }
        }
开发者ID:viciousviper,项目名称:pCloud.NET,代码行数:19,代码来源:FolderViewModel.cs

示例4: dataTransferManager_DataRequested

 async   void dataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
    {
        DataRequest request = args.Request;
        //We are going to use an async API to talk to the webview, so get a deferral for the results
        DataRequestDeferral deferral = args.Request.GetDeferral();
        DataPackage dp = await homewebview.CaptureSelectedContentToDataPackageAsync();
        if (dp != null && dp.GetView().AvailableFormats.Count >0)
        { // Webview has a selection, so we'll share its data package
            dp.Properties.Title = "来自多彩浏览器的分享";
            request.Data = dp;
        }
        else { 
            // No selection, so we'll share the url of the webview
            DataPackage myData = new DataPackage();
            myData.SetWebLink(homewebview.Source);
            myData.Properties.Title = "来自多彩浏览器的分享";
            myData.Properties.Description = homewebview.Source.ToString();
            request.Data = myData; }
        deferral.Complete();
    }
开发者ID:gisdaodao,项目名称:ii,代码行数:20,代码来源:HomePage.xaml.cs

示例5: SetWebLink

        /// <summary>
        /// Sets the current web link content that is stored in the clipboard.
        /// </summary>
        /// <param name="content">The web link content that is stored in the clipboard.</param>
        public virtual void SetWebLink(Uri content)
        {
            var package = new DataPackage();

            package.SetWebLink(content);

            Clipboard.SetContent(package);
        }
开发者ID:Cimbalino,项目名称:Cimbalino-Toolkit,代码行数:12,代码来源:ClipboardService.cs

示例6: DataTransferManager_DataRequested

        /// <summary>
        /// Raised when the user initiates a Share operation.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        async void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
        {
            DataRequest request = args.Request;
            // We are going to use an async API to talk to the webview, so get a deferral to give
            // us time to generate the results.
            DataRequestDeferral deferral = request.GetDeferral();
            DataPackage dp = await WebViewControl.CaptureSelectedContentToDataPackageAsync();

            // Determine whether there was any selected content.
            bool hasSelection = false;
            try
            {
                hasSelection = (dp != null) && (dp.GetView().AvailableFormats.Count > 0);
            }
            catch (Exception ex)
            {
                switch (ex.HResult)
                {
                    case unchecked((int)0x80070490):
                        // Mobile does not generate a data package with AvailableFormats
                        // and results in an exception. Sorry. Handle the case by acting as
                        // if we had no selected content.
                        hasSelection = false;
                        break;

                    default:
                        // All other exceptions are unexpected. Let them propagate.
                        throw;
                }
            }

            if (hasSelection)
            {
                // Webview has a selection, so we'll share its data package.
                dp.Properties.Title = "WebView sample selected content";
            }
            else
            {
                // No selection, so we'll share the url of the webview.
                dp = new DataPackage();
                dp.SetWebLink(WebViewControl.Source);
                dp.Properties.Title = "WebView sample page";
            }
            dp.Properties.Description = WebViewControl.Source.ToString();
            request.Data = dp;

            deferral.Complete();
        }
开发者ID:AJ-COOL,项目名称:Windows-universal-samples,代码行数:53,代码来源:Scenario7_Share.xaml.cs

示例7: FillPackage

		private static void FillPackage(StorageFile[] files, DataPackage package, object subShareItem)
		{
			if (subShareItem != null)
			{
				switch (subShareItem.GetType().Name)
				{
					case nameof(TextShareItem):
						{
							package.SetText((subShareItem as TextShareItem).Text);
						}
						break;
					case nameof(ApplicationLinkShareItem):
						{
							var sitm = subShareItem as ApplicationLinkShareItem;
							package.SetApplicationLink(sitm.ApplicationLink);
						}
						break;

					case nameof(DelayRenderedImageShareItem):
						{
							var sitm = subShareItem as DelayRenderedImageShareItem;
							package.SetBitmap(RandomAccessStreamReference.CreateFromStream(sitm.SelectedImage.GetRandowmAccessStream()));
						}
						break;

					case nameof(FilesShareItem):
						{
							StorageFile[] resultArray = files;
							package.SetStorageItems(resultArray);
						}
						break;
					case nameof(HtmlShareItem):
						{
							var sitm = subShareItem as HtmlShareItem;

							var fmt = HtmlFormatHelper.CreateHtmlFormat(sitm.HtmlFragment);
							package.SetHtmlFormat(fmt);
							package.SetText(sitm.HtmlFragment);

						}
						break;
					case nameof(WebLinkShareItem):
						{
							var sitm = subShareItem as WebLinkShareItem;
							package.SetWebLink(sitm.WebLink);
							package.SetText(sitm.WebLink?.ToString());

						}
						break;

					default:
						break;
				}

			}
		}
开发者ID:waynebaby,项目名称:GreaterShareUWP,代码行数:56,代码来源:DefaultShareService.cs

示例8: CopyLink

 /// <summary>
 /// Копировать ссылку в клипборд.
 /// </summary>
 public async void CopyLink()
 {
     try
     {
         var webLink = link.GetWebLink();
         if (webLink != null)
         {
             var dp = new DataPackage();
             dp.SetText(webLink.ToString());
             dp.SetWebLink(webLink);
             Clipboard.SetContent(dp);
             Clipboard.Flush();
         }
     }
     catch (Exception ex)
     {
         await AppHelpers.ShowError(ex);
     }
 }
开发者ID:Opiumtm,项目名称:DvachBrowser3,代码行数:22,代码来源:FavoriteMainTileViewModel.cs

示例9: CopyMediaLinkFlyoutItem_OnClick

 private async void CopyMediaLinkFlyoutItem_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         var f = sender as FrameworkElement;
         var t = f?.Tag as IPostMediaFileViewModel;
         if (t?.WebLink != null)
         {
             var dp = new DataPackage();
             dp.SetText(t.WebLink);
             dp.SetWebLink(new Uri(t.WebLink, UriKind.Absolute));
             Clipboard.SetContent(dp);
             Clipboard.Flush();
         }
     }
     catch (Exception ex)
     {
         await AppHelpers.ShowError(ex);
     }
 }
开发者ID:Opiumtm,项目名称:DvachBrowser3,代码行数:20,代码来源:PostView.xaml.cs

示例10: CopyLinkFlyoutItem_OnClick

 private async void CopyLinkFlyoutItem_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         var f = sender as FrameworkElement;
         var t = f?.Tag as IPostViewModel;
         if (t?.Link != null)
         {
             var uri = t.Link.GetWebLink();
             if (uri != null)
             {
                 var dp = new DataPackage();
                 dp.SetText(uri.ToString());
                 dp.SetWebLink(uri);
                 Clipboard.SetContent(dp);
                 Clipboard.Flush();
             }
         }
     }
     catch (Exception ex)
     {
         await AppHelpers.ShowError(ex);
     }
 }
开发者ID:Opiumtm,项目名称:DvachBrowser3,代码行数:24,代码来源:PostCollectionView.xaml.cs


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