Windows Azure Developer Day - WAMS

  • View
    564

  • Download
    1

Embed Size (px)

Transcript

  • 1. Introducing Cloud Architecture The Cloud Architecture IaaS PaaS Next Generation Cloud Service Architecture PaaS/IaaS

2. Windows Azure Mobile Services (WAMS) PaaS : SQL Database Services : Authentication Services : Push Notification Services App , 3. App Accessing data authentication Call web service 4. .. Web Service , , Web Server Web Service ASP.NET PHP .. 5. 6. .. 7. Web Service .. App . 8. Windows Azure Mobile Service SQL Database Service Facebook, Microsoft Account, Google Account Twitter Web Server Database Server Windows Azure Mobile Service (WP,Android,iOS) (Node.js) App 9. WAMS, .. 10. Windows Azure Mobile Service DEMO 11. 12. Can use by any user Need application key Authenticated users Internal use only 13. Google Account Facebook, Microsoft Account, Google Account Twitter 14. Google Account Authorized Redirect URIs Authorized JavaScript Origins 15. Google Account 16. App Server Side App, ? 17. Windows Phone NuGet Package Manager WAMS Client Library's 18. Azure Mobile Services Application Key 19. Mobile Service public partial class App : Application { internal static MobileServiceClient MobileService = new MobileServiceClient("https://todo64.azure-mobile.net/", "xisXQCpUGwQfwOwUqvxcqwkVhtdiLR72"); MobileServiceClient 20. using Microsoft.WindowsAzure.MobileServices; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TodoApplication { [DataTable("todos")] public class TodoDataModel { public int Id { get; set; } public string Description { get; set; } public bool Complete { get; set; } } } Windows Azure Mobile Services 21. public partial class MainPage : PhoneApplicationPage { private MobileServiceUser user; private async System.Threading.Tasks.Task Authenticate() { while (user == null) { try { user = await App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.Google); } catch (InvalidOperationException) { Dispatcher.BeginInvoke(() => { MessageBox.Show("You must log in. Login Required"); }); } } } private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { await Authenticate(); } 22. ? (Facebook, Microsoft Account, Google Account , Twitter) (WAMS) WAMS, , Client Librarys , Server-Side Script Custom API 23. Table Triggers CRUD Node.js, .NET Language(C# ) 24. Storing User ID Insert, ID createDate, userId WAMS, 25. UI , , UI 26. Test And Run 27. Designing UI and Get data Todo Item record ListBox 28. , Read 29. CUD 30. Custom API WAMS, 31. Custom API API 32. Push Notification channels push notification services (WP, iOS, Android) channel Push Notification ServicesID push uri 33. channel API 34. 35. Script 36. Test And Run Demo 37. SQL Server? 38. Android Version 39. ? client library's for android http://go.microsoft.com/fwlink/p/?linkid=28 0126&clcid=0x409 android project (libs/) 40. mobile service client UI _client = new MobileServiceClient("https://todo64.azure-mobile.net/", "WGoPUayxXeaWRsOiHrzGfcotvffFfM31", this); 41. _table.execute(new TableQueryCallback() { @Override public void onCompleted(List result, int count, Exception exception, ServiceFilterResponse response) { if(exception == null){ _adapter.clear(); for (Todo item : result) { _adapter.add(item); } } } }); 42. CUD _table.insert(item, new TableOperationCallback()); _table.delete(item, new TableOperationCallback()); _table.update(item, new TableOperationCallback()); 43. Integrate Google Cloud Message Google Cloud Message Library Google Play Services API 44. CUSTOM API ArrayList parameters = new ArrayList(); parameters.add(new Pair("device", "android")); parameters.add(new Pair("uri", regID)); _client.invokeApi("addchannel", "POST", parameters, new ApiJsonOperationCallback() { @Override public void onCompleted(JsonElement jsonObject, Exception exception, ServiceFilterResponse response) { int i = 0; i = i++; } }); 45. Test And Run Demo 46. IOS 47. Whats you need? Client Library's https://go.microsoft.com/fwLink/p/?LinkID=26 6533 iOS Project 48. mobile service client UI //in .h @property (nonatomic, strong) MSClient *client; // in .m self.client = [MSClient clientWithApplicationURLString:@"https://todo64.azure- mobile.net/" applicationKey:@""]; 49. self.table = [self.client tableWithName:@todos"]; NSPredicate * predicate = [NSPredicate predicateWithFormat:@Complete == NO"]; [self.table readWithPredicate:predicate completion:^(NSArray *results, NSInteger totalCount, NSError *error) { self.items = [results mutableCopy]; [self.tableView reloadData]; }]; 50. Implement CUD Operations MSTable insertupdatedeleteWindows Phone AndroidiOSCustomers NSDictionary NSDictionary *item = @{ @Description" : buy computer }; 51. Windows Azure Mobile Document http://www.windowsazure.com/en- us/develop/mobile/reference/ My Blog http://www.dotblogs.com.tw/code6421 Windows Azure Mobile Service SDK for Windows Phone 7 https://github.com/zaxy78/azure-mobile-wp7- sdk (unofficial)