UWPの共有で使われる項目がよくわからなかったので調べてみた
写真は単なる釣りです。
ほとんど使っていないと思いますがWindows10の場合は Win+Hで共有チャーム(ってまだ呼んでいいの?)が出てきますね。 存在を知らない人もかなりいるんじゃないでしょうか。
それでもUWP(Universal Windows Platform)アプリでちょっとツイートしたい、って時にわざわざtwitterのAPIを実装するなんてダルすぎなので使ってみようと思いました。
何が共有されるのかよくわからなかったのでテストしてみた
共有機能に関してはDataTransferManager
でできるんですが、共有のガイドラインっぽいものが残念ながら私には見つけられず何を入れればどこに出るのかがいまいちだったので一通り設定してみてどう出るのか試してみました。
試してみた結果を書いているだけなので間違いがあるかもしれませんよ。
テスト用コードはこんな感じ。面倒そうなのはパスで。
private static void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { var package = args.Request.Data; package.Properties.ApplicationListingUri = new Uri("http://ApplicationListingUri"); package.Properties.ApplicationName = "ApplicationName"; package.Properties.ContentSourceApplicationLink = new Uri("http://ContentSourceApplicationLink"); package.Properties.ContentSourceWebLink = new Uri("http://ContentSourceWebLink"); package.Properties.Description = "Description"; package.Properties.EnterpriseId = "EnterpriseId"; package.Properties.LogoBackgroundColor = Colors.Magenta; package.Properties.PackageFamilyName = "PackageFamilyName"; package.Properties.Title = "Title"; package.Properties.Square30x30Logo = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Square30x30Logo.png")); package.Properties.Thumbnail = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Thumb.png")); package.SetApplicationLink(new Uri("https://SetApplicationLink")); package.SetBitmap(RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Bitmap.jpg"))); package.SetHtmlFormat("<http>SetHtmlFormat</http>"); package.SetText("package.SetText"); package.SetWebLink(new Uri("https://SetWebLink")); }
出てきたアプリに片っ端から送ってみる
このPCにインストールしている対応アプリに片っ端から送って、使用しているプロパティ(メソッド)をあげてみます。
Mevy
- Thmbnail
- Title
- Description
- SetText
- SetWebLink
メール
- Title
- SetBitmap
- SetWebLink
Aero Prism
なにもなかった・・・
メッセージング
- Title
- SetWebLink
- Title
Aristea
- Title
- SetBitmap
- Description
- SetWebLink
- SetText
Nextgen Reader
- Title
- SetWebLink
- SetText
- SetWebLink
リーディングリスト
- Title
- Description
- SetBitmap
- LogoBackgroundColor
- Square30x30Logo
Collect Traveler
- SetBitmap
ばらばら ですね。
SetWebLink
が結構使われていますが、これを 指定しない とSetText
が使われるっていうアプリが多い気がします。
結論
わかんねー
自分が使ってみて使いやすいように実装すればいいのかな?