{"id":5901,"date":"2014-06-12T12:07:13","date_gmt":"2014-06-12T03:07:13","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=5901"},"modified":"2014-06-12T12:12:55","modified_gmt":"2014-06-12T03:12:55","slug":"xamarin-froms-%e3%81%a7%e3%83%91%e3%82%ba%e3%83%ab%e3%82%b2%e3%83%bc%e3%83%a0%e3%82%92%e4%bd%9c%e3%82%8bwindows-phone%e7%89%88","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/5901","title":{"rendered":"Xamarin.Froms \u3067\u30d1\u30ba\u30eb\u30b2\u30fc\u30e0\u3092\u4f5c\u308b(Windows Phone\u7248)"},"content":{"rendered":"<p>\u6628\u65e5\u306e\u7d9a\u304d\u3067&#8230;\u3068\u8a00\u3044\u307e\u3059\u304b\u3001\u5b9f\u88c5\u306f\u6628\u65e5\u306e\u3046\u3061\u306b\u6e08\u307e\u305b\u307e\u3057\u305f\u3002\u79fb\u690d\u81ea\u4f53\u306f\u7c21\u5358\u3067\uff11\u6642\u9593\u304b\u304b\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/06\/image7.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/06\/image_thumb7.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"640\" height=\"444\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" \/><\/a><\/p>\n<p>\u3061\u3087\u3063\u3068\u3001XAML\u3092\u66f8\u304d\u76f4\u3057\u3066\u3001\u30b3\u30de\u306e\u5927\u304d\u3055\u3092\u5909\u3048\u305f\u308a\u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\u3057\u305f\u308a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>\u25a0\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u306f ApplicationData.Current.LocalFolder \u3092\u4f7f\u3046<\/h3>\n<p>\u57fa\u672c\u7684\u306a\u3068\u3053\u308d\u306f\u3001iOS\/Android \u3068\u540c\u3058\u306a\u306e\u3067\u3059\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u90e8\u5206\u304c\u3061\u3087\u3063\u3068\u3060\u3051\u9055\u3044\u307e\u3059\u3002iOS\/Android \u306e\u5834\u5408\u306f\u3001System.Environment.GetFolderPath \u3092\u4f7f\u3063\u3066\u666e\u901a\u306e\u30d5\u30a9\u30eb\u30c0\u30a2\u30af\u30bb\u30b9\uff08\u3068\u3044\u3048\u3001\u30a2\u30d7\u30ea\u5185\u306e\u30d5\u30a9\u30eb\u30c0\u3060\u3051\u306a\u306e\u3067\u3059\u304c&#8230;\u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30eb\u30c0\u3078\u306e\u30a2\u30af\u30bb\u30b9\u306f\u8981\u8abf\u67fb\uff09\u3068\u540c\u69d8\u306b\u4f7f\u3048\u307e\u3059\u304c\u3001Windows Phone \u306e\u5834\u5408\u306f\u3001ApplicationData.Current.LocalFolder \u3092\u4f7f\u3044\u307e\u3059\u3002\u3053\u308c\u306f WinRT \u3068\u540c\u3058\u3067\u3001\u30a2\u30d7\u30ea\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30d5\u30a9\u30eb\u30c0\u304c OS \u4e0a\u3067\u5236\u9650\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u304c\u300c\u5171\u6709\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u300d\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u3053\u306e\u305f\u3081\u3067\u3082\u3042\u3063\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b #if \u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u5206\u5c90\u3055\u305b\u307e\u3059\u3002PCL \u3067\u3084\u308b\u3068\u3001\u3053\u3053\u306e\u30b3\u30fc\u30c9\u30d3\u30cf\u30a4\u30c9\u304c\u59d4\u8b72\u3092\u4f7f\u3063\u305f\u308a\u3057\u3066\u9762\u5012\u306a\u306e\u3067\u3001\u305d\u306e\u307e\u307e\u30b3\u30fc\u30c9\u5171\u6709\u3067\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nvar se = new XmlSerializer(typeof(MyData));\r\ntry\r\n{\r\n#if __IOS__ || __ANDROID__ \r\n    var documents =\r\n        System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);\r\n    var file = System.IO.Path.Combine(documents, &quot;mydata.xml&quot;);\r\n    using (var stream = System.IO.File.OpenRead(file))\r\n    {\r\n        var m = se.Deserialize(stream) as MyData;\r\n        m.CopyTo(_model);\r\n    }\r\n#else\r\n    using (var stream = await Windows.Storage.ApplicationData.Current.LocalFolder.OpenStreamForReadAsync(\r\n        &quot;mydata.xml&quot;))\r\n    {\r\n        var m = se.Deserialize(stream) as MyData;\r\n        m.CopyTo(_model);\r\n    }\r\n#endif\r\n}\r\ncatch\r\n{\r\n    \/\/ \u5404\u30b9\u30b3\u30a2\u30920\u306b\u3059\u308b\r\n    this._logic.Reset();\r\n}\r\n<\/pre>\n<p>stream \u3092\u53d6\u308b\u3068\u3053\u308d\u306f\u4e00\u7dd2\u306a\u306e\u3067\u3001Windows Phone \u3067\u4f7f\u3063\u3066\u3044\u308b OpenStreamForReadAsync \u30e1\u30bd\u30c3\u30c9\u3092\u3001\u9069\u5f53\u306b\u5305\u3093\u3067\u3084\u308c\u3070\u5171\u6709\u5316\u3067\u304d\u308b\u306e\u3067\u3059\u304c&#8230;\u307e\u3042\u3001\u3053\u306e\u307e\u307e\u3067\u3002\u6c17\u306b\u306a\u308b\u306e\u306f\u3001iOS\/Android \u3067\u4f7f\u3063\u3066\u3044\u308b\u306e\u306f OpenWrite \u3067\u540c\u671f\u30e1\u30bd\u30c3\u30c9\u306a\u3093\u3060\u3051\u3069\u3001Windows Phone \u306e OpenStreamForReadAsync \u306f\u975e\u540c\u671f\u30e1\u30bd\u30c3\u30c9\u3063\u3066\u3068\u3053\u308d\u3067\u3059\u3088\u306d\u3002\u3053\u3053\u306f\u975e\u540c\u671f\u306b\u63c3\u3048\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<h3>\u25a0\u30b2\u30fc\u30e0\u30ed\u30b8\u30c3\u30af\u3084Azure Mobile Serivces \u306f\u3001PCL \u3067<\/h3>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/06\/image8.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/06\/image_thumb8.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"337\" height=\"330\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;\" \/><\/a><\/p>\n<p>PCL\uff08\u79fb\u690d\u53ef\u80fd\uff09\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u306f\u30b2\u30fc\u30e0\u30ed\u30b8\u30c3\u30af\u3068Azure Mobile Service \u306e\u3068\u3053\u308d\u3067\u3059\u3002\u30ab\u30e1\u30e9\u6a5f\u80fd\u3068\u304b\u306f <a href=\"http:\/\/components.xamarin.com\/view\/xamarin.mobile\">Xamarin.Mobile<\/a> \u3092\u4f7f\u3048\u3070\u5171\u6709\u5316\u3067\u304d\u308b\u306e\u3067\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u3082\u306e\u306a\u3089\u3070\u7d50\u69cb\u3059\u3093\u306a\u308a\u5171\u6709\u5316\u3067\u304d\u308b\u304b\u306a\u3068\u3002\u305f\u3060\u3057\u3001\u30ab\u30e1\u30e9\u3092\u64ae\u3063\u305f\u5f8c\u306e\u9077\u79fb\u304c\u5404\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3067\u82e5\u5e72\u7570\u306a\u308b\u306e\u3067\u3001\u305d\u306e\u3042\u305f\u308a\u306f\u3072\u3068\u5de5\u592b\u304c\u5fc5\u8981\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u25a0\u753b\u50cf\u30ea\u30bd\u30fc\u30b9\u306f\u3069\u3046\u3059\u308b\uff1f<\/p>\n<p>\u3053\u306e\u30a2\u30d7\u30ea\u3067\u306f\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n_mk&#x5B;0] = ImageSource.FromFile(&quot;MarkNone.png&quot;)\r\n<\/pre>\n<p>\u306a\u611f\u3058\u3067\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3057\u3066\u76f4\u63a5\u53d6\u3063\u3066\u304d\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u306e\u30eb\u30fc\u30c8\u304c\u4f55\u51e6\u3092\u6307\u3059\u304b\u3068\u3044\u3046\u3068\u3001\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u6bce\u306b\u9055\u3063\u3066\u3044\u3066\u3001<\/p>\n<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"71\">iOS<\/td>\n<td valign=\"top\" width=\"329\">\/Resources\/MarkNone.png<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"71\">Android<\/td>\n<td valign=\"top\" width=\"329\">\/Resources\/Drawable\/MarkNone.png<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"71\">WinPhone<\/td>\n<td valign=\"top\" width=\"329\">\/MarkNone.png<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3063\u3066\u306a\u611f\u3058\u3067\u3001Windows Phone \u306f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u76f4\u4e0b\u3092\u793a\u3057\u3066\u3044\u308b\u3068\u3044\u3046&#8230;\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u3061\u308a\u3070\u3081\u3089\u308c\u308b\u306e\u306f\u5acc\u306a\u306e\u3067\u3001\u3053\u306e\u3042\u305f\u308a WinPhone \u306e\u305f\u3081\u306b Images \u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u3066\u3001<\/p>\n<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"71\">iOS<\/td>\n<td valign=\"top\" width=\"329\">\/Resources\/Images\/MarkNone.png<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"71\">Android<\/td>\n<td valign=\"top\" width=\"329\">\/Resources\/Drawable\/Images\/MarkNone.png<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"71\">WinPhone<\/td>\n<td valign=\"top\" width=\"329\">\/Images\/MarkNone.png<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3068\u304b\u306b\u3057\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u306d\u3002\u3061\u306a\u307f\u306b\u3001Windows Phone \u306b\u306f Resources \u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u3053\u306f\u53c2\u7167\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u305f\u3060\u3057\u3001\u753b\u50cf\u304c\u305f\u304f\u3055\u3093\u3042\u3063\u305f\u308a\u591a\u8a00\u8a9e\u5316\u3092\u8003\u3048\u308b\u3068\u3001\u30ea\u30bd\u30fc\u30b9\u3092\u4f7f\u3044\u305f\u3044\u308f\u3051\u3067\u3001\u305d\u306e\u3042\u305f\u308a\u306f <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/5859\">Xamarin.iOS\/Android \u3067\u3001\u6587\u5b57\u5217\u3068\u753b\u50cf\u3092PCL\u3092\u4f7f\u3063\u3066\u5171\u6709\u3055\u305b\u308b\u65b9\u6cd5<\/a> \u3092\u4f7f\u3063\u3066 PCL \u306b\u3057\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002\u3053\u3053\u3067\u306e\u65b9\u6cd5\u306f iOS\/Android \u3057\u304b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3001WinPhone \u3068 WinRT \u306b\u3082\u62e1\u5f35\u3057\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u306d\u3002<\/p>\n<p>\u25a0\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/p>\n<p>\u3082\u3046\u5c11\u3057\u624b\u3092\u5165\u308c\u307e\u3059\u304c\u3001\u73fe\u72b6\u306e\u306f Github \u306b<br \/>\n<a href=\"https:\/\/github.com\/moonmile\/TMPuzzleXForms\">https:\/\/github.com\/moonmile\/TMPuzzleXForms<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6628\u65e5\u306e\u7d9a\u304d\u3067&#8230;\u3068\u8a00\u3044\u307e\u3059\u304b\u3001\u5b9f\u88c5\u306f\u6628\u65e5\u306e\u3046\u3061\u306b\u6e08\u307e\u305b\u307e\u3057\u305f\u3002\u79fb\u690d\u81ea\u4f53\u306f\u7c21\u5358\u3067\uff11\u6642\u9593\u304b\u304b\u308a\u307e\u305b\u3093\u3002 \u3061\u3087\u3063\u3068\u3001XAML\u3092\u66f8\u304d\u76f4\u3057\u3066\u3001\u30b3\u30de\u306e\u5927\u304d\u3055\u3092\u5909\u3048\u305f\u308a\u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\u3057\u305f\u308a\u3057\u3066\u3044\u307e\u3059\u3002 \u25a0\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u306f A &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/5901\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[64,62,65],"tags":[],"class_list":["post-5901","post","type-post","status-publish","format-standard","hentry","category-android","category-xamarin","category-ios"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=5901"}],"version-history":[{"count":2,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5901\/revisions"}],"predecessor-version":[{"id":5903,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5901\/revisions\/5903"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=5901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=5901"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=5901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}