Your SlideShare is downloading. ×
TMCN tech-cafe Vol.01 Day3資料
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

TMCN tech-cafe Vol.01 Day3資料

172
views

Published on

Published in: Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
172
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TMCN tech-cafe Vol.01 「Leap in the Cloud」 LeapMotionの可能性は雲の中に 2014/4/23 初音玲
  • 2. 資料:MSDN http://msdn.microsoft.com/ja-jp/ library/azure/ jj554228.aspx
  • 3. .NET(VB/C#) http://azure.microsoft.com/en-us/ documentation/articles/ mobile-services-windows-dotnet-how-to-use- client-library/
  • 4. JavaScript:... http://azure.microsoft.com/en-us/ documentation/articles/ mobile-services-html-how-to-use-client- library/
  • 5. 準備:VB.NET / C# 1. プロジェクトを右クリックし、[NuGet パッケージの管理] を選択 2. WindowsAzure.MobileServices パッケージを検索して追加 3. "using Microsoft.WindowsAzure.MobileServices;" を追加 4. 次のコードを追加 public static MobileServiceClient MobileService = new MobileServiceClient( "https://leapcloud.azure-mobile.net/");
  • 6. ユーザ登録:VB.NET/C# public class UserItem { public string Id { get; set; } public string UserId { get; set; } public string UserName { get; set; }} private IMobileServiceTable<UserItem> userTable =App.MobileService.GetTable<UserItem>(); await userTable.InsertAsync(new UserItem {UserName = “hatsune_"}); var query = userTable.CreateQuery(); query.Parameters.Add("UserName","hatsune_"); var response = await query.ToListAsync();
  • 7. じゃんけん:VB.NET/C#
  • 8. 準備:JS 1. HTML部分へ追加 <script src="http://ajax.aspnetcdn.com/ajax/mobileservices/MobileSe rvices.Web-1.1.3.min.js"></script> 2. JavaScriptコードに追加 var client = new WindowsAzure.MobileServiceClient( "https://leapcloud.azure- mobile.net/");
  • 9. ユーザ登録:JS var item = { UserName: “hatsune_” }; client.getTable(“UserItem").insert(item); userItemTable = client.getTable(‘UserItem'); var query = userItemTable.where({UserName: “hatsune_”}); query.read().then(function(userItems){ var listItems = $.map(userItems, function(item) { item.UserId }); };
  • 10. 参考:UserItem-insert.js function insert(item, user, request) { var userDeviceTable = tables.getTable('UserItem'); userDeviceTable.where({ UserName: item.UserName }).read({ success: function(results) { if (results.length > 0) { console.log('User %s is duplicate.', item.UserId); request.respond(statusCodes.BAD_REQUEST, 'ユーザ名が重複しています。'); } else { request.execute(); } } }); }
  • 11. 参考:UserItem-read.js function read(query, user, request) { var param = request.parameters.UserName; if (param) { var sql = "SELECT Id,Id AS UserId,UserName “ + “FROM [LeapCloud].UserItem WHERE UserName = ?"; mssql.query(sql, param, { success: function (results) { request.respond(statusCodes.OK, results); } }); } else { request.respond(statusCodes.BAD_REQUEST, 'ユーザ名が登録されていません。'); } }