private async void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs e) { DataRequest request = e.Request; var uri = string.Format("http://www.last.fm/music/{0}/{1}", Locator.MusicPlayerVM.CurrentArtist?.Name, Locator.MusicPlayerVM.CurrentAlbum?.Name); var title = string.Format("#NowPlaying {0} - {1}", Locator.MusicPlayerVM.CurrentTrack?.Name, Locator.MusicPlayerVM.CurrentArtist?.Name); request.Data.Properties.Title = title; request.Data.Properties.Description = title; request.Data.SetWebLink(new Uri(uri, UriKind.Absolute)); DataRequestDeferral deferral = request.GetDeferral(); try { string fileName = string.Format("{0}.jpg", Locator.MusicPlayerVM.CurrentAlbum.Id); var albumPic = await ApplicationData.Current.LocalFolder.GetFolderAsync("albumPic"); if (await albumPic.ContainsFileAsync(fileName)) { var file = await albumPic.GetFileAsync(fileName); request.Data.SetStorageItems(new List <StorageFile> { file }); } } catch { deferral.Complete(); } finally { deferral.Complete(); } }
private async void _dataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequestDeferral deferral = args.Request.GetDeferral(); sender.TargetApplicationChosen += (s, e) => { deferral.Complete(); }; await CurrentImage.SetDataRequestData(args.Request); deferral.Complete(); }
private async void ShareImageHandler(DataTransferManager sender, DataRequestedEventArgs e) { if (SharedSpreekwoord != null) { DataRequest request = e.Request; request.Data.Properties.Title = SharedSpreekwoord.SpreekWoord; request.Data.Properties.Description = "Spreekwoord van Spreekwoorden voor Windows Phone"; // Because we are making async calls in the DataRequested event handler, // we need to get the deferral first. DataRequestDeferral deferral = request.GetDeferral(); StorageFile ImageFile = null; // Make sure we always call Complete on the deferral. try { ImageFile = await Datahandler.GetSmallSpreekwoordenTile(SharedSpreekwoord.ID); } catch { e.Request.FailWithDisplayText("Spreekwoord kan niet worden gedeeld :("); } try { request.Data.SetBitmap(RandomAccessStreamReference.CreateFromFile(ImageFile)); } finally { deferral.Complete(); } } }
private async void myDataManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { if (GuessBox.Text == " ") { return; } DataPackage myData = args.Request.Data; myData.Properties.Description = "Meaning: " + GuessBox.Text + "."; myData.SetText("Translation" + GuessBox.Text); DataRequestDeferral deferral = args.Request.GetDeferral(); try { StorageFile imageFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync( new System.Uri((Application.Current as App)._dictionaryList[myIndex].strSignImage)); myData.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile)); } finally { deferral.Complete(); } }
async void dtm_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { string FileTitle = "31 Days of Windows 8!"; string FileDescription = "This just explains what we're sharing."; //This is an optional value. DataPackage data = args.Request.Data; data.Properties.Title = FileTitle; data.Properties.Description = FileDescription; DataRequestDeferral waiter = args.Request.GetDeferral(); try { StorageFile image = await Package.Current.InstalledLocation.GetFileAsync("Assets\\0.png"); data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(image); data.SetBitmap(RandomAccessStreamReference.CreateFromFile(image)); List <IStorageItem> files = new List <IStorageItem>(); files.Add(image); data.SetStorageItems(files); } finally { waiter.Complete(); } }
async void dtm_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { string FileTitle = "31 Days of Windows 8!"; string FileDescription = "This just explains what we're sharing."; //This is an optional value. DataPackage data = args.Request.Data; data.Properties.Title = FileTitle; data.Properties.Description = FileDescription; DataRequestDeferral waiter = args.Request.GetDeferral(); try { StorageFile textFile = await Package.Current.InstalledLocation.GetFileAsync("FileForSharing.txt"); List <IStorageItem> files = new List <IStorageItem>(); files.Add(textFile); data.SetStorageItems(files); } finally { waiter.Complete(); } }
private void ShareImageHandler(DataTransferManager sender, DataRequestedEventArgs e) { DataRequest request = e.Request; ResourceCandidate resource; resource = ResourceManager.Current.MainResourceMap.GetValue("Resources/uidShareTitle", ResourceContext.GetForCurrentView()); request.Data.Properties.Title = resource.ValueAsString; resource = ResourceManager.Current.MainResourceMap.GetValue("Resources/uidShareDescription", ResourceContext.GetForCurrentView()); request.Data.Properties.Description = resource.ValueAsString; // Because we are making async calls in the DataRequested event handler, // we need to get the deferral first. DataRequestDeferral deferral = request.GetDeferral(); // Make sure to always call Complete on the deferral. try { RandomAccessStreamReference imageStreamRef = RandomAccessStreamReference.CreateFromFile(_photo); request.Data.SetBitmap(imageStreamRef); } finally { deferral.Complete(); } }
private async void ShareViewModel_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequestDeferral deferral = args.Request.GetDeferral(); try { var request = args.Request; request.Data.Properties.Title = path.Description + " @ " + session.DayOfSession; request.Data.Properties.Description = path.Description + " @ " + session.DayOfSession; List <IStorageItem> l = new List <IStorageItem>(); String unit = nowhereman.Properties.getProperty("units", "m"); StorageFile file = format == "gpx"? await UniversalKeepTheRhythm.Others.ExportImport.exportGpx(idSession, "route.gpx", unit, resourceLoader) : await UniversalKeepTheRhythm.Others.ExportImport.exportKml(idSession, "route.kml", unit, resourceLoader); //RandomAccessStreamReference image = null; //image = RandomAccessStreamReference.CreateFromFile(file); l.Add(file); //request.Data.Properties.Thumbnail = image; //request.Data.SetBitmap(image); request.Data.SetStorageItems(l); } finally { deferral.Complete(); } }
private async void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequest request = args.Request; request.Data.Properties.Title = NowItem.title; request.Data.SetText(NowItem.description + "\n" + NowItem.date.ToString("D")); DataRequestDeferral deferral = request.GetDeferral(); List <string> data = DataAccess.GetData(); byte[] thispic = null; int i = 0; while (i < data.Count) { if (data[i] == NowItem.GetId()) { thispic = Convert.FromBase64String(data[i + 5]); break; } i += 6; } StorageFile picfile = await ApplicationData.Current.LocalFolder.CreateFileAsync("tempic", CreationCollisionOption.ReplaceExisting); await FileIO.WriteBytesAsync(picfile, thispic); request.Data.SetBitmap(RandomAccessStreamReference.CreateFromFile(picfile)); deferral.Complete(); }
// Handle DataRequested event and provide DataPackage private void OnShareDataRequested(DataTransferManager sender, DataRequestedEventArgs args) { Models.TodoItem sharedItem = ViewModel.GetItemById(currentId); var data = args.Request.Data; DataRequestDeferral GetFiles = args.Request.GetDeferral(); try { data.Properties.Title = sharedItem.Title; data.Properties.Description = sharedItem.Discription; var imageFile = sharedItem.ShareFile; if (imageFile != null) { data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(imageFile); data.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile)); } else { data.SetText(sharedItem.Discription); // if no image, share text } } finally { GetFiles.Complete(); } }
private async static void Manager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequestDeferral dataRequestDeferral = args.Request.GetDeferral(); List <IStorageItem> items = new List <IStorageItem>(); foreach (ListedItem li in dataGrid.SelectedItems) { if (li.FileExtension == "Folder") { var folderAsItem = await StorageFolder.GetFolderFromPathAsync(li.FilePath); items.Add(folderAsItem); } else { var fileAsItem = await StorageFile.GetFileFromPathAsync(li.FilePath); items.Add(fileAsItem); } } DataRequest dataRequest = args.Request; dataRequest.Data.SetStorageItems(items); dataRequest.Data.Properties.Title = "Data Shared From Files"; dataRequest.Data.Properties.Description = "The items you selected will be shared"; dataRequestDeferral.Complete(); }
private async void App_DataRequested(Windows.ApplicationModel.DataTransfer.DataTransferManager sender, Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs args) { if (_deckToShare != null) { args.Request.Data.Properties.Title = "Sharing Dragon Front Deck"; args.Request.Data.Properties.Description = _deckToShare.Name; DataRequestDeferral deferral = args.Request.GetDeferral(); try { if (string.IsNullOrEmpty(_deckToShare.FilePath)) { _deckToShare = await SimpleIoc.Default.GetInstance <IDeckService>().SaveDeckAsync(_deckToShare); if (_deckToShare == null) { return; } } var file = await StorageFile.GetFileFromPathAsync(_deckToShare.FilePath); var list = new List <StorageFile>(); list.Add(file); args.Request.Data.SetStorageItems(list); } catch (Exception) { } finally { deferral.Complete(); } } }
private void ShareHtmlHandler(DataTransferManager sender, DataRequestedEventArgs e) { DataRequest request = e.Request; DataRequestDeferral deferral = request.GetDeferral(); request.Data.Properties.Title = "Instructions to sync IE's favorites on your desktop to SkyDrive"; request.Data.Properties.Description = ""; if (counter == this.promoContentSource.GetPromoData.Count - 1) { try { string localImage = "ms-appx:///Assets/SkyDriveSetupInstruction.png"; string html = @"<html><body><h2>Instructions to sync IE's favorites on your desktop to SkyDrive</h2>" + @"<p><img src=""" + localImage + @""" alt=""Sync Favorites""></p>" + @"<p><ol>" + @"<li>Download SkyDrive http://windows.microsoft.com/en-us/skydrive/download</li>" + @"<li>Open directory c:\users\%username%. (Replace %username% with login ID you use to logon to your computer)</li>" + @"<li>Right click on Favorites folder and click Properties -> Click Location tab -> Click Move</li>" + @"<li>Choose the folder C:\Users\%username%\SkyDrive\RoamingFavoritesApp\Bookmark.</li>" + @"<li>Open folder C:\Users\%username%\SkyDrive and right click on RoamingFavoritesApp folder and click Make available offline.</li>" + @"<li>Done. Repeat above instructions for all of your laptop/desktop.</li>" + @"</ol></p></body></html>"; request.Data.SetHtmlFormat(HtmlFormatHelper.CreateHtmlFormat(html)); request.Data.Properties.ApplicationName = "Favorites Browser"; RandomAccessStreamReference streamRef = RandomAccessStreamReference.CreateFromUri(new Uri(localImage)); request.Data.ResourceMap[localImage] = streamRef; } catch { request.FailWithDisplayText("Folder can't be shared as bookmarks."); } //do nothing : might be empty string becuase only folder is selected } else { request.FailWithDisplayText("Nothing to share."); } deferral.Complete(); }
async void MainPage_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequest request = args.Request; DataRequestDeferral deferral = request.GetDeferral(); try { var saveFile = await StaticTaqModelView.saveUi2Png("screenshot.png", mainPage); var storageItems = new List <IStorageItem>(); storageItems.Add(saveFile); // 3. Share it //request.Data.SetText("TAQ"); request.Data.Properties.Title = Windows.ApplicationModel.Package.Current.DisplayName; // Facebook app supports SetStorageItems, not SetBitmap. request.Data.SetStorageItems(storageItems); } catch (Exception ex) { Debug.WriteLine(ex.Message); // Ignore. } finally { deferral.Complete(); } }
//<SnippetHowToShareImage_CS> //<SnippetHowToShareImage> void DataRequested(DataTransferManager sender, DataRequestedEventArgs e) { //<SnippetDataRequestDeferral_CS> //<SnippetDataRequestDeferral> DataRequestDeferral deferral = e.Request.GetDeferral(); //</SnippetDataRequestDeferral> //</SnippetDataRequestDeferral_CS> e.Request.Data.Properties.Title = "Hello World!"; e.Request.Data.Properties.Description = "This example shows how to share files and images."; //<SnippetAddThumbnailForImage_CS> if (this.dataPackageThumbnail != null) { e.Request.Data.Properties.Thumbnail = this.dataPackageThumbnail; } //</SnippetAddThumbnailForImage_CS> //<SnippetSetBitmap_CS> //<SnippetSetBitmap> e.Request.Data.SetBitmap(imageStreamRef); //</SnippetSetBitmap> //</SnippetSetBitmap_CS> //<SnippetDeferralComplete_CS> //<SnippetDeferralComplete> deferral.Complete(); //</SnippetDeferralComplete_CS> //</SnippetDeferralComplete> }
private void PageExplorerDataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataPackage data = args.Request.Data; DataRequestDeferral waiter = args.Request.GetDeferral(); try { List <IStorageItem> files = new List <IStorageItem>(); int index = 0; foreach (var item in itemGridView.SelectedItems) { ExplorerItem explorerItem = (ExplorerItem)item; if (explorerItem != null) { if (index == 0) { data.Properties.Title = explorerItem.Name; RandomAccessStreamReference image = RandomAccessStreamReference.CreateFromFile(explorerItem.StorageFile); data.Properties.Thumbnail = image; data.SetBitmap(image); } files.Add(explorerItem.StorageFile); } index++; } data.SetStorageItems(files); data.SetText("\n"); } finally { waiter.Complete(); } }
private async void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { string textSource; textSource = "我正在gamestate中参加游戏,一起来玩吧"; string textTitle = "一起来玩小游戏呀!"; string textDescription = "最新潮最好玩的小游戏"; DataPackage data = args.Request.Data; data.Properties.Title = textTitle; data.Properties.Description = textDescription; data.SetText(textSource); DataRequestDeferral GetFiles = args.Request.GetDeferral(); try { StorageFile imageFile = await Package.Current.InstalledLocation.GetFileAsync("Assets\\99.png"); data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(imageFile); data.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile)); } finally { GetFiles.Complete(); } }
private void GetShareContent(DataRequest request) { if (_currentComic != null) { DataRequestDeferral deferral = request.GetDeferral(); DataPackage requestData = request.Data; requestData.Properties.Title = _currentComic.Title; requestData.Properties.Description = _currentComic.Subtitle; string textToShare = string.Format("Title: {1}{0}Number: {2}{0}Published: {3}{0}Alternate Text: {4}", Environment.NewLine, _currentComic.Title, _currentComic.Number, _currentComic.Date.ToString("d"), _currentComic.AltText); requestData.SetText(textToShare); var bitmap = RandomAccessStreamReference.CreateFromUri(_currentComic.ImageUri); request.Data.Properties.Thumbnail = bitmap; requestData.SetBitmap(bitmap); requestData.SetUri(_currentComic.Uri); deferral.Complete(); } else { request.FailWithDisplayText("Select a comic you would like to share and try again."); } }
private async void shareStorageItemsHandler(DataTransferManager sender, DataRequestedEventArgs e) { DataRequest request = e.Request; request.Data.Properties.Title = shareTitle; request.Data.Properties.Description = shareDesc; DataRequestDeferral deferral = request.GetDeferral(); try { if (!string.IsNullOrEmpty(shareText)) { request.Data.SetText(shareText); } if (shareImage) { StorageFile shareFile = await ApplicationData.Current.LocalFolder.GetFileAsync(shareDataFilename); var storageItems = new List <IStorageItem>(); storageItems.Add(shareFile); request.Data.SetStorageItems(storageItems); } } catch (Exception ex) { UnityEngine.Debug.LogError(ex.Message); } finally { deferral.Complete(); } }
private async void ShareTextHandler(DataTransferManager sender, DataRequestedEventArgs e) { DataRequest request = e.Request; // Title is mandatory request.Data.Properties.Title = string.IsNullOrEmpty(_title) ? Windows.ApplicationModel.Package.Current.DisplayName : _title; DataRequestDeferral deferral = request.GetDeferral(); try { if (!string.IsNullOrWhiteSpace(_filePath)) { StorageFile attachment = await StorageFile.GetFileFromPathAsync(_filePath); List <StorageFile> storageItems = new List <StorageFile>(); storageItems.Add(attachment); request.Data.SetStorageItems(storageItems); } request.Data.SetText(_message ?? string.Empty); } finally { deferral.Complete(); } }
async void ShareRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequest request = args.Request; DataRequestDeferral getFile = args.Request.GetDeferral(); if (songList.SelectedItem != null) { request.Data.Properties.Title = "给你分享一首好歌:" + songList.SelectedItem.name; request.Data.SetText("歌手是" + songList.SelectedItem.singer + "\n" + "复制链接到浏览器收听" + songList.SelectedItem.path); } else { request.Data.Properties.Title = Name.Text; request.Data.SetText(Singer.Text); } try { //图片分享未完成 //StorageFile image_File = await StorageFile.GetFileFromApplicationUriAsync(new Uri("Assets/音符.png")); //request.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(image_File); //request.Data.SetBitmap(RandomAccessStreamReference.CreateFromFile(image_File)); } finally { getFile.Complete(); } }
private async void HandleTransferManagerDataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequest request = args.Request; DataRequestDeferral defferal = request.GetDeferral(); request.Data.Properties.Title = Strings.GetResource("ExportStatsFileTitle"); StorageFolder folder = ApplicationData.Current.LocalFolder; using (Stream fileStream = await folder.OpenStreamForWriteAsync(UPLOAD_STATS_FILE_NAME, CreationCollisionOption.ReplaceExisting)) { using (StreamWriter writer = new StreamWriter(fileStream)) { foreach (SongViewModel song in LibraryViewModel.Current.FlatSongCollection) { writer.WriteLine(String.Join("|", new string[] { song.Name, song.AlbumName, song.ArtistName, song.Rating.ToString(), song.PlayCount.ToString(), song.LastPlayed.Ticks.ToString() })); } } } StorageFile file = await folder.GetFileAsync(UPLOAD_STATS_FILE_NAME); request.Data.SetData(StandardDataFormats.StorageItems, new List <StorageFile>() { file }); defferal.Complete(); }
private async void ShareImageHandler(DataTransferManager sender, DataRequestedEventArgs e) { DataRequest request = e.Request; request.Data.Properties.Title = "Camup Image"; request.Data.Properties.Description = "Image captured in CamUp and shared."; DataRequestDeferral deferral = request.GetDeferral(); try { StorageFile thumbnailFile = await StorageFile.GetFileFromPathAsync(_path); request.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(thumbnailFile); StorageFile imageFile = await StorageFile.GetFileFromPathAsync(_path); request.Data.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile)); } finally { deferral.Complete(); } }
public async Task SetDataRequestData(DataRequest request) { DataPackage requestData = request.Data; requestData.Properties.Title = "Share photo"; requestData.Properties.ContentSourceWebLink = new Uri(FullImageUrl); requestData.Properties.ContentSourceApplicationLink = new Uri(FullImageUrl); var shareText = $"Share {this.Owner.Name}'s amazing photo from MyerSplash UWP app. {FullImageUrl}"; requestData.SetText(shareText); DataPackage dataPackage = new DataPackage(); dataPackage.SetText(shareText); Clipboard.SetContent(dataPackage); DataRequestDeferral deferral = request.GetDeferral(); var file = await StorageFile.GetFileFromPathAsync(ListImageCachedFilePath); if (file != null) { List <IStorageItem> imageItems = new List <IStorageItem>(); imageItems.Add(file); requestData.SetStorageItems(imageItems); RandomAccessStreamReference imageStreamRef = RandomAccessStreamReference.CreateFromFile(file); requestData.SetBitmap(imageStreamRef); requestData.Properties.Thumbnail = imageStreamRef; } deferral.Complete(); }
private void OnShareDataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataPackage data = args.Request.Data; //string textSource = "title and description from Todo item"; data.Properties.Title = ViewModel.SelectedItem.title; data.Properties.Description = ViewModel.SelectedItem.description; //data.SetText(textSource); DataRequestDeferral GetFiles = args.Request.GetDeferral(); try { if (ImageFile != null) { data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(ImageFile); data.SetBitmap(RandomAccessStreamReference.CreateFromFile(ImageFile)); } else { data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(ViewModel.SelectedItem.shareFile); data.SetBitmap(RandomAccessStreamReference.CreateFromFile(ViewModel.SelectedItem.shareFile)); } } finally { GetFiles.Complete(); } }
private async void Manager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequestDeferral dataRequestDeferral = args.Request.GetDeferral(); List <IStorageItem> items = new List <IStorageItem>(); foreach (ListedItem item in App.CurrentInstance.ContentPage.SelectedItems) { if (item.PrimaryItemAttribute == StorageItemTypes.Folder) { var folderAsItem = await StorageFolder.GetFolderFromPathAsync(item.ItemPath); items.Add(folderAsItem); } else { var fileAsItem = await StorageFile.GetFileFromPathAsync(item.ItemPath); items.Add(fileAsItem); } } DataRequest dataRequest = args.Request; dataRequest.Data.SetStorageItems(items); dataRequest.Data.Properties.Title = "Data Shared From Files"; dataRequest.Data.Properties.Description = "The items you selected will be shared"; dataRequestDeferral.Complete(); }
private async void DTM_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataPackage data = args.Request.Data; data.Properties.Title = App.account + "'s Checkbook"; var content = ""; for (int i = 0; i < ViewModel.AllItems.Count; ++i) { var item = ViewModel.AllItems[i]; content += item.DATETIME.ToString().Substring(0, 9) + "\t" + item.COST + "¥\t" + item.NAME + "\t" + item.NOTE + "\n"; } content += "======================\n"; content += "当前余额:" + leftMoney.Text; data.SetText(content); DataRequestDeferral GetFiles = args.Request.GetDeferral(); try { StorageFile imageFile = await Package.Current.InstalledLocation.GetFileAsync("Assets\\checkbook.jpg"); data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(imageFile); data.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile)); } finally { GetFiles.Complete(); } }
private void OnDataTransferRequested(DataTransferManager sender, DataRequestedEventArgs args) { if (downloadModel == null) { return; } DataRequest request = args.Request; DataRequestDeferral deferral = request.GetDeferral(); try { using (MemoryStream buffer = new MemoryStream()) { downloadModel.Stream.Position = 0; downloadModel.Stream.CopyTo(buffer); buffer.Position = 0; request.Data.Properties.Title = downloadModel.Date.ToString("yyyy-MM-dd HH:mm:ss"); request.Data.Properties.Description = client.Name; request.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromStream(buffer.AsRandomAccessStream()); request.Data.SetBitmap(RandomAccessStreamReference.CreateFromStream(buffer.AsRandomAccessStream())); } } finally { deferral.Complete(); } }
private void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { DataRequestDeferral deferral = args.Request.GetDeferral(); args.Request.Data.Properties.Title = "分享诗词"; args.Request.Data.Properties.Description = "《" + poetryItem.Name + "》"; args.Request.Data.SetText("我正在赏析诗人" + poetryItem.AuthorName + "的《" + poetryItem.Name + "》。\n" + poetryItem.Content); deferral.Complete(); }
void dtm_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { args.Request.Data.Properties.Title = "Pepco"; args.Request.Data.SetHtmlFormat(HtmlFormatHelper.CreateHtmlFormat("Hey there! This is an interesting app, get it from Windows Store!")); args.Request.Data.SetText("Indeed awesome game"); DataRequestDeferral d = args.Request.GetDeferral(); args.Request.Data.SetUri(new Uri("http://windows.microsoft.com/en-US/windows-8/apps")); d.Complete(); }