Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Gradnja povezanih aplikacij

1,363 views

Published on

Slides from my session at NT conference 2013 Windows 8 and Windows Phone 8 precon track

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Gradnja povezanih aplikacij

  1. 1. 100300Gradnja povezanih aplikacijDamir Arh, Adacta d.o.o.Arhitekt programske opremeMVP – Visual C#@DamirArh, http://www.damirscorner.com
  2. 2. 100300Agenda Pomen povezanosti Načini povezovanja Lepo obnašanje Windows Phone
  3. 3. 100300Današnje aplikacije
  4. 4. 100300Programski vmesniki (API)HTTP APIsSocket APIsBackground APIsData APIsJson XML StreamsDataReader/DataWriterInformation APIsDownloadWeb servicesSkydriveTCP sockets UDP sockets SSL sockets Web SocketsAtomPubRSSNetwork InformationProximity socketsLive IDUploadXbox Live AzureHttpWebRequestHttpClientXHRIXHRWCFAtomRTC Push NotificationCost
  5. 5. 100300Viri RSS
  6. 6. 100300RSS : ATOM
  7. 7. 100300Poenoteno branjevar client = new SyndicationClient();var feed = await client.RetrieveFeedAsync(new Uri(uri));var title = feed.Title.Text;var subtitle = feed.Id;var description = feed.Subtitle.Text;foreach (var feedItem in feed.Items){var iUniqueId = feedItem.Id;var iTitle = feedItem.Title.Text;var iSubtitle = feedItem.Summary.NodeValue;var iDescription = feedItem.PublishedDate.ToString();var iContent = feedItem.NodeValue;
  8. 8. 100300Podpora objavljanjuvar client = new AtomPubClient(credentials);var item = new SyndicationItem();item = await client.CreateResourceAsync(uri, title, item);item = await client.RetrieveResourceAsync(uri);await client.UpdateResourceAsync(uri, item);await client.DeleteResourceAsync(uri);
  9. 9. 100300PodporaWCF
  10. 10. 100300Omejitve implementacije Podprt zgolj odjemalec Spreminjanje nastavitev le skozi kodo Omejen nabor podprtih Bindingov BasicHttpBinding NetTcpBinding NetHttpBinding CustomBinding Druge omejitve
  11. 11. 100300OAuth inREST
  12. 12. 100300OAuth 2
  13. 13. 100300WebAuthenticationBrokervar requestUri = String.Format("{0}/client_id={1}&redirect_uri={2}",oauthUri,clientId,redirectUri);var result = await WebAuthenticationBroker.AuthenticateAsync(options,requestUri, responseUri);var authenticationCode = result.ResponseData;
  14. 14. 100300OAuth 1
  15. 15. 100300HttpClientvar client = new HttpClient();var result = await client.GetStringAsync(uri);var content = StringContent(body);content = FormUrlEncodedContent(dictionary);var response = await client.PostAsync(uri,content);result = await response.Content.ReadAsStringAsync();
  16. 16. 100300JSON{"access_token":"1/fFAGRNJ","expires_in":3920,"token_type":"Bearer","refresh_token":"1/xEoDL4iW3"}using Windows.Data.Json;var jsonObject = JsonObject.Parse(json);var jsonValue = jsonObject["access_token"];var token = jsonValue.GetString();
  17. 17. 100300XML<xml><access_token>1/fFAGRNJ</access_token><expires_in>3920</expires_in><token_type>Bearer</token_type><refresh_token>1/xEoDL4iW3</refresh_token></xml>using System.Xml.Linq;var xDoc = XDocument.Parse(xml);var token = xDoc.Element("xml").Element("access_token").Value;
  18. 18. 100300OData
  19. 19. 100300OData in Windows Store
  20. 20. 100300Poizvedbe z ODatavar query = context.Posts.Expand("Parent").Where(p => p.OwnerUserId == 197913 &&p.PostTypeId == 2).OrderByDescending(p =>p.CreationDate);((DataServiceQuery<Post>)query).BeginExecute();var result = await Task.Factory.FromAsync();var list = result.ToList();
  21. 21. 100300Prenosdatotek
  22. 22. 100300BackgroundTransferusing Windows.Networking.BackgroundTransfer;var downloader = new BackgroundDownloader();var uri = new Uri(downloadUri);var file = await ApplicationData.Current.LocalFolder.CreateFileAsync(filename);var dl = downloader.CreateDownload(uri, file);await dl.StartAsync();
  23. 23. 100300Prenosi v tekuvar downloads = await BackgroundDownloader.GetCurrentDownloadsAsync();download.RequestedUridownload.ResultFile.Pathdownload.Progress.BytesReceiveddownload.Progress.TotalBytesToReceivedownload.AttachAsync().AsTask(cancellationToken, progress);
  24. 24. 100300Dostop do standardnih map Aplikacije se izvajajo v peskovniku Mape z različnimi nivoji dostopa ApplicationData.Current.LocalFolder ApplicationData.Current.RoamingFolder ApplicationData.Current.TemporaryFolder Package.Current.InstalledLocation DownloadsFolder KnownFolders.MusicLibrary KnownFolders.PicturesLibrary KnownFolders.VideosLibrary KnownFolders.DocumentsLibrary KnownFolders.RemovableDevices
  25. 25. 100300Pravice za omrežni dostop Tri kategorije Internet (Client) Internet (Client & Server) Private Networks (Client & Server) Pravilnik o zasebnosti
  26. 26. 100300Lokalne povezave
  27. 27. 100300CheckNetIsolation.exeCheckNetIsolation.exe LoopbackExempt –sCheckNetIsolation.exe LoopbackExempt –a-n=packagename_ynxpx341dyebpCheckNetIsolation.exe LoopbackExempt –d-n=packagename_ynxpx341dyebpCheckNetIsolation.exe LoopbackExempt –c
  28. 28. 100300Podatki o povezavi NetworkCostType Unrestricted Fixed Variable Unknown ApproachingDataLimit OverDataLimit RoamingNetworkInformation.GetInternetConnectionProfile().GetConnectionCost()
  29. 29. 100300Prilagajanje delovanja Običajno Omrežje: unrestricted ali unknown Obnašanje: Brez omejitev Omejeno Omrežje: fixed ali variable Obnašanje: Prenos manj podatkov Na zahtevo Omrežje: OverDataLimit ali Roaming Brez samodejnega prenosa
  30. 30. 100300Windows Phone 8 Alternativne implementacije System.ServiceModel.Syndication BackgroundTransferService Okrnjena funkcionalnost WCF Ni na voljo WebAuthenticationBroker Windows.Data.JSON
  31. 31. 100300Sklep Spoznajte platformo Izkoristite ponujeno Zavedajte se omejitev Mislite na uporabnika
  32. 32. 300VPRAŠANJAProsimo vas, da po koncu predavanja izpolnitevprašalnike. Nekoga izmed vas bomo nagradiliz Nokio Lumia 820.Vprašalniki bodo poslani na vaš e-naslov,dostopni pa bodo tudi preko profila na spletnemmestu www.ntk.siNajlepša hvala!Iščete kakovostno izobraževanje? Obiščite Microsoftove izobraževalne centre:Uspeh = Znanje = Microsoftovi uradni tečaji + predavatelji Microsoft Certified Trainer

×