从 Windows 8.1 和 Windows Phone 8.1 向 Facebook 共享文本 [英] Share text to facebook from Windows 8.1 and Windows Phone 8.1

查看:28
本文介绍了从 Windows 8.1 和 Windows Phone 8.1 向 Facebook 共享文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在分享一些带有 Facebook 链接的文本,这些文本来自 Windows Phone 8.1 和 Windows 8.1 上的应用程序.我想为社交媒体(我想成为我的应用程序的链接#MyApp")和电子邮件和文本(我想成为我的一点点文字")使用不同的文本.

I'm sharing some text with a link to facebook from apps on Windows Phone 8.1 and Windows 8.1. I want to have different text for social media (which I want to be "My App's link #MyApp") and email and text (which I want to be "My little bit of text").

在 Windows 手机中,以下代码有效:

In Windows phone the following code works:

DataRequest request = GetMyDataRequest();

// for social media
request.Data.SetRtf("My App's link #MyApp");

// for email and text
request.Data.SetText("My little bit of text");

但是,在 Windows 8.1 中,电子邮件和社交媒体都使用 request.Data.SetText() 函数 - 所以当我想要社交媒体时,我看到电子邮件和社交媒体的我的一点点文字"成为不同的文字.

However when it comes to windows 8.1, both email and social media use the request.Data.SetText() function - so I'm seeing "My little bit of text" for email and social media, when I want social media to be different text.

所以我的问题是,当我共享一些文本时,如何让 Windows 8.1 表现得像 Windows Phone.或者我可能如何确定我想要进行哪种共享(电子邮件、文本、社交媒体)并设置相关文本(不过我不确定这是否可行).或者也许问题是何时以及为什么使用 SetRtf/SetText,是否可以覆盖它?

So my question is, how do I get windows 8.1 to behave like windows phone when I share some text. Or possibly how do I determine what kind of share (email, text, social media) I want to do and set the relevant text (I'm not sure this is possible though). Or maybe the question is when and why is SetRtf/SetText used, and is it possible to override this?

谢谢

推荐答案

共享合约背后的假设是源应用(你的)有一个内容要共享,但内容可能有不同的表示或访问方式它.例如,您可以将一大块文本作为纯文本、RTF 甚至 HTML 共享,后两种格式提供了改进其格式的机会.同样,您可以将图像共享为位图、文件或云资源的 URI.

The assumption behind the share contract is that the source app (yours) has one piece of content to share but that the content may have different representations or means of accessing it. For instance, you might share a chunk of text as plain text, as RTF, or even HTML, with the latter two formats offering the opportunity to spiff up its formatting. Similarly, you might share an image as a bitmap, as a file, or as a URI to a cloud resource.

在共享操作的另一端,每个目标应用程序可能只理解或处理您提供的格式的一些子集,并会在它认为合适的时候从 DataPackage 中提取这些格式.给定应用处理的格式(以及优先顺序)完全由该应用的开发者决定,因此您无法真正对社交媒体"等一类应用做出假设.

On the other side of the sharing operation, each target app may only understand or deal with some subset of the formats that you've provided and will pluck those formats off of the DataPackage as it sees fit. Which formats a given app handles (and in what order of preference) is entirely determined by that app's developer so you can't really make assumptions about a class of apps like "social media".

这篇关于从 Windows 8.1 和 Windows Phone 8.1 向 Facebook 共享文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆