本文整理汇总了C#中Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataRequestedEventArgs类的具体用法?C# DataRequestedEventArgs怎么用?C# DataRequestedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataRequestedEventArgs类属于Windows.ApplicationModel.DataTransfer命名空间,在下文中一共展示了DataRequestedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnDataRequested
private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
// Get the user's selection from the WebView.
DataPackage requestData = ShareWebView.DataTransferPackage;
DataPackageView dataPackageView = requestData.GetView();
if ((dataPackageView != null) && (dataPackageView.AvailableFormats.Count > 0))
{
string dataPackageTitle = TitleInputBox.Text;
// The title is required.
if (!String.IsNullOrEmpty(dataPackageTitle))
{
requestData.Properties.Title = dataPackageTitle;
// The description is optional.
string dataPackageDescription = DescriptionInputBox.Text;
if (dataPackageDescription != null)
{
requestData.Properties.Description = dataPackageDescription;
}
e.Request.Data = requestData;
}
else
{
e.Request.FailWithDisplayText(MainPage.MissingTitleError);
}
}
else
{
e.Request.FailWithDisplayText("Make a selection in the HTML fragment and try again.");
}
}
开发者ID:jkuemerle,项目名称:CodeMash2013,代码行数:33,代码来源:ShareHtml.xaml.cs
示例2: ShareTextHandler
private void ShareTextHandler(DataTransferManager sender, DataRequestedEventArgs e)
{
try
{
DataRequest request = e.Request;
// The Title is mandatory
#if WINDOWS_UWP
request.Data.Properties.Title = title ?? Windows.ApplicationModel.Package.Current.DisplayName;
#elif WINDOWS_APP
request.Data.Properties.Title = title ?? Windows.ApplicationModel.Package.Current.DisplayName;
#else
request.Data.Properties.Title = title ?? string.Empty;
#endif
if (!string.IsNullOrWhiteSpace(url))
{
request.Data.SetWebLink(new Uri(url));
}
request.Data.SetText(text ?? string.Empty);
}
catch(Exception ex)
{
Debug.WriteLine("Unable to share text: " + ex);
}
}
开发者ID:nielscup,项目名称:SharePlugin,代码行数:28,代码来源:ShareImplementation.cs
示例3: OnDataRequested
private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
args.Request.Data.SetText(
$"{loader.GetString("SendMeFriendRequest/Text")} {_link} {Environment.NewLine} {loader.GetString("SentFromPlayStationApp/Text")}");
args.Request.Data.Properties.Title = loader.GetString("InviteFriendsToPsn/Text");
}
开发者ID:drasticactions,项目名称:Pureisuteshon-App,代码行数:7,代码来源:FriendLinkPage.xaml.cs
示例4: OnDataRequested
private async void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
var vm = ((DashboardViewModel) DataContext);
if ( vm.SelectedItem == null)
{
args.Request.FailWithDisplayText("You have not selected an item to share");
}
else
{
var deferral = args.Request.GetDeferral();
var dataPackage = args.Request.Data;
var propertySet = dataPackage.Properties;
propertySet.Title = vm.SelectedItem.Name;
propertySet.Description = vm.SelectedItem.ShortDescription;
//ShareText(dataPackage, vm.SelectedItem.Name);
//ShareUrl(dataPackage, "http://www.espn.com");
await ShareFileAsync(vm, dataPackage, propertySet);
deferral.Complete();
}
}
开发者ID:derikwhittaker,项目名称:LiveLessons.WinRT,代码行数:25,代码来源:DashboardPage.xaml.cs
示例5: ShareStorageItemsHandler
private async void ShareStorageItemsHandler(DataTransferManager sender,
DataRequestedEventArgs e)
{
var request = e.Request;
request.Data.Properties.Title = AppResourcesHelper.Get("Export_FileTitle");
request.Data.Properties.Description = ApplicationResourcesHelper.Get("CATROBAT_URL");
var deferral = request.GetDeferral();
try
{
var rootFolder = ApplicationData.Current.LocalFolder;
var fileToShare = await rootFolder.GetFileAsync(_pathToShareFile);
var storageItems = new List<IStorageItem> { fileToShare };
request.Data.SetStorageItems(storageItems);
}
catch
{
if (Debugger.IsAttached)
Debugger.Break();
}
finally
{
deferral.Complete();
}
}
开发者ID:Catrobat,项目名称:CatrobatForWindows,代码行数:25,代码来源:ShareServiceWindowsShared.cs
示例6: ShareLinkHandler
private void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs e)
{
DataRequest request = e.Request;
request.Data.Properties.Title = "Title";
request.Data.Properties.Description = "Description";
request.Data.SetWebLink(new Uri(""+ Windows.ApplicationModel.Store.CurrentApp.LinkUri));
}
开发者ID:mohamedemam0,项目名称:RateAndShare,代码行数:7,代码来源:MainPage.xaml.cs
示例7: BlankPage_DataRequested
void BlankPage_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
var request = args.Request;
request.Data.Properties.Title = App.ViewModel.SelectedDocument.GetDisplayName();
request.Data.Properties.Description = string.Format("Created {0}", App.ViewModel.SelectedDocument.GetCreatedDate().ToString("g"));
request.Data.SetText(_GetCurrentDocumentText());
}
开发者ID:sourcebits-thrivikramkashyap,项目名称:MetroPad,代码行数:7,代码来源:BlankPage.xaml.cs
示例8: DataRequested
private void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
DataRequest request = e.Request;
request.Data.Properties.Title = "كلام جرايد";
request.Data.SetText("يقوم هذا البرنامج بتجميع الأخبار من مصادر متنوعة و تقسيمه حسب نوعه ويقوم بعرض العناوين الأخبار فى الصفحة الرئيسية و يقوم ايضا بعرض الخبر كامل من مصدره" + "\n" + (new Uri("ms-windows-store:navigate?appid=" + CurrentApp.AppId)).ToString());
}
开发者ID:MohamedELSaQeR,项目名称:My-Apps,代码行数:7,代码来源:about_page.xaml.cs
示例9: dataTransferManager_DataRequested
private void dataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
if (OnShareRequested != null)
{
OnShareRequested(args.Request.Data);
}
}
开发者ID:JacobAtchley,项目名称:MyVote,代码行数:7,代码来源:ShareManager.cs
示例10: PageExplorerDataRequested
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();
}
}
开发者ID:CasaTeam,项目名称:MetroExplorer,代码行数:34,代码来源:PageExplorerSearchShare.cs
示例11: DataTransferManager_DataRequested
private void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
DataRequest request = args.Request;
var currentImage = dataContext.AlbumItem.AlbumImages[dataContext.SelectedIndex];
request.Data.Properties.Title = currentImage.Title ?? dataContext.AlbumItem.Title;
request.Data.SetWebLink(new Uri(currentImage.Link));
}
开发者ID:nilsbenson,项目名称:MonocleGiraffe,代码行数:7,代码来源:AlbumPage.xaml.cs
示例12: ShareTextHandler
/// <summary>
/// This is the text handler for the sharing purposes.
/// </summary>
/// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param>
/// <param name="e">DataRequestedEventArgs e is a parameter called e that contains the event data, see the DataRequestedEventArgs MSDN page for more information.</param>
public static void ShareTextHandler(DataTransferManager sender, DataRequestedEventArgs e)
{
DataRequest request = e.Request;
request.Data.Properties.Title = "BuildmLearn Store";
request.Data.Properties.Description = "BuildmLearn Store Share";
request.Data.SetText("Share Text");
}
开发者ID:BuildmLearn,项目名称:BuildmLearn-Store,代码行数:12,代码来源:AppCommon.cs
示例13: DataTransferManager_DataRequested
// *** Private Methods ***
private async void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
DataRequestDeferral deferral = args.Request.GetDeferral();
IShareRequest shareRequest = new ShareRequest(args.Request);
await ShareRequested(shareRequest);
deferral.Complete();
}
开发者ID:deepakpal9046,项目名称:Okra.Core,代码行数:9,代码来源:ShareSourceManager.cs
示例14: DataRequested
protected override void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
VideoItem vi = (this.DataContext as VideoItem);
args.Request.Data.Properties.Title = vi.Name;
args.Request.Data.Properties.Description = vi.Description;
args.Request.Data.SetUri(vi.KhanPath);
}
开发者ID:npatta01,项目名称:Khan-Academy-for-WinRT,代码行数:7,代码来源:VideoPage.xaml.cs
示例15: DataTransferManager_DataRequested
void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
if (_dataRequested != null)
{
_dataRequested((DataTransferManager)sender, new SettableDataRequestedEventArgs(e));
}
}
开发者ID:schmidp,项目名称:GettingStartedWithMetroApps,代码行数:7,代码来源:DataTransferManagerAdapter.cs
示例16: ShareLinkHandler
private void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs args)
{
DataRequest request = args.Request;
request.Data.Properties.Title = "分享博客";
request.Data.Properties.Description = "向好友分享这篇博客";
request.Data.SetWebLink(new Uri(_blog.BlogRawUrl));
}
开发者ID:BourbonShi,项目名称:CNBlogs.UWP,代码行数:7,代码来源:BlogContentPage.xaml.cs
示例17: OnDataRequested
private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
if (YouTubeChannelModel != null)
{
YouTubeChannelModel.GetShareContent(args.Request);
}
}
开发者ID:ProjectsInChasz,项目名称:DjangoDjangoFunApp,代码行数:7,代码来源:YouTubeChannelDetailPage.xaml.cs
示例18: ShareLinkHandler
private void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs args)
{
DataRequest request = args.Request;
request.Data.Properties.Title = "分享文章[来自UWP应用:知乎日报]";
request.Data.Properties.Description = "向好友分享这篇文章";
request.Data.SetWebLink(new Uri(_viewModel.ShareUrl));
}
开发者ID:Mukosame,项目名称:ZhihuDaily,代码行数:7,代码来源:ContentPage.xaml.cs
示例19: OnDataRequested
private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
if (PolarProModel != null)
{
PolarProModel.GetShareContent(args.Request);
}
}
开发者ID:jookie,项目名称:Gaj2,代码行数:7,代码来源:PolarProPage.xaml.cs
示例20: ShareLinkHandler
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();
}
}
开发者ID:robUx4,项目名称:vlc-winrt,代码行数:30,代码来源:ShareNowPlayingMusicCommand.cs
注:本文中的Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论