Win8: Share

简介:

现在大部分的应用都喜欢在App中加入社交分享的功能,这样做当然是为了推广、吸取更多的用户。

Android及iOS平台要实现分享到某一个社交网络,例如sina微博,通常的做法主要是使用其官方提供的SDK,或者自己完成OAuth(很多平台都采用这种认证),拿到相应的token,再调用所需API。前者要简单得多。

但在win8平台上,因为其系统绑定了分享(charm中的共享),使得共享实现只需几行代码就搞定:

复制代码
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", dataRequested);

    function dataRequested(e) {
        var request = e.request;
        request.data.properties.title = "现代教育技术电子书"
        request.data.properties.description = "我正在看《现代教育技术》Win8版";
        var text = "这个应用不错,和大家分享! http://www.cnblogs.com/mybkn/";
        request.data.setText(text);
    }
复制代码

这样就搞定了,出来效果:

               

 

 

check:http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.datatransfer.datatransfermanager

 

本文转自老Zhan博客园博客,原文链接:http://www.cnblogs.com/mybkn/archive/2013/04/23/3038144.html,如需转载请自行联系原作者

相关文章
|
Java Android开发
Java环境变量配置(win7+win10)
Java环境变量配置(win7+win10)
264 0
|
机器学习/深度学习 Shell 决策智能
No rule to make target `/usr/lib/arm-linux-gnueabihf/libopencv_videostab.so.2.4.8'
No rule to make target `/usr/lib/arm-linux-gnueabihf/libopencv_videostab.so.2.4.8'
167 0
|
分布式计算 Hadoop Linux
Windows运行Hadoop时报错:Could not locate executablenull\bin\winutils.exe in the Hadoo
Windows运行Hadoop时报错:Could not locate executable null\bin\winutils.exe in the Hadoop binaries 从标题报错中就可以看到,不能定位到winutils.exe,在hadoop中
223 0
未解决:lrelease: could not exec ‘/usr/lib/qt5/bin/lrelease‘: No such file or directory
未解决:lrelease: could not exec ‘/usr/lib/qt5/bin/lrelease‘: No such file or directory
226 0
bin/arm-linux-androideabi-nm: libtinfo.so.5: cannot open shared object file: No such file or directo
bin/arm-linux-androideabi-nm: libtinfo.so.5: cannot open shared object file: No such file or directo
103 0
|
计算机视觉
谨慎试之:libopencv_core.so.3.4, needed by //usr/local/lib/libopencv_imgcodecs.so
谨慎试之:libopencv_core.so.3.4, needed by //usr/local/lib/libopencv_imgcodecs.so
339 0
"\Tools\QtCreator\bin\clangbackend.exe" could not be started
"\Tools\QtCreator\bin\clangbackend.exe" could not be started
399 0