Page 55 - MSDN Magazine, April 2017
P. 55

multicolor
hit-
highlighting
easy
options
®
The most important class here is the TileUpdateManager from the Windows.UI.Notifications namespace. This class not only creates a template internally to send to the tile, but also polls the specified URL for tile XML content through startPeriodicUpdate method. The duration of the poll can be set using the Periodic- UpdateRecurrence enumeration to period pull the XML content for Tiles. This approach is more server-driven where the Web API sends the XML code and tile template to the client. This is feasible when the developer has control over the app and the service layers.
Now consider a scenario in which the app receives information from third-party Web APIs such as weather or market research data. In such scenarios, mostly the Web APIs would send standard HTTP responses in terms of body, headers and so on. Here, you can parse the Web API response and then form an XML tile of content in the client-side UWP app code in JavaScript. This gives the app developer more control over the type of templates to display the data. You can also mention the expiration time for the tile through the TileNotification class. The code for this is shown in Figure 9.
Note the TileTemplateType class provides the functionality of creating a square tile template 310 x 310px in size with an image and text. Also, the expiration time for the tile is set to 10 minutes through code, which means that after this time, the Live Tile would revert to the default app tile provided in the app pack- age, unless a new notification arrives in the app in form of push notifications. More information about available tile templates can be found at bit.ly/2k5PDJj.
Wrapping Up
There are a few things to consider while planning the migration fromaWebapptoaUWPapp:
1. Test your app for layout and rendering with modern browsers (Microsoft Edge is an example).
2. If your Web app is dependent on an ActiveX control or plug-in, ensure an alternative way to make the functionality work when running on modern browsers or as a UWP app.
3. Use the SiteScan tool at bit.ly/1PJBcpi to surface recommen- dations related to libraries and functionality.
4. Identify URLs of external resources that your Web site references. These will be required to be added to the Appli- cationContentUriRules section of the Appx.manifest file.
Additionally, there are many deeper integrations that can be achieved through the JavaScript Windows object and help light up the app functionality through richer experiences. Contacts, Camera, Microphone, Toast notifications and many features open a window of opportunity for blending your Web site with the app persona. The code in this article has been converted into a project template and madeavailablefordevelopersthroughGitHubatbit.ly/2k5FlJh. n
Sagar BhanudaS JoShi has worked with developers and ISVs on the Universal Windows Platform and Microsoft Azure for more than six years. His role includes working with startups to help them architect, design, and provide on-board solu- tions and applications to Azure, Windows, and the Office 365 platform. Joshi lives and works in Mumbai, India. Find him on Twitter: @sagarjms.
ThankS to the following Microsoft technical experts who reviewed this article: Sandeep Alur and Ashish Sahu
msdnmagazine.com
Instantly Search Terabytes of Data
across a desktop, network, Internet or Intranet site with dtSearch enterprise and developer products
Over 25 search features, with
dtSearch’s document filters support popular file types, emails with multilevel attachments, databases, web data
Developers:
• APIs for .NET, Java and C++
• SDKs for Windows, UWP, Linux, Mac and Android
• See dtSearch.com for articles on faceted search, advanced data classification, working with SQL, NoSQL & other DBs, MS Azure, etc.
Visit dtSearch.com for
• hundreds of reviews and case studies • fully-functional evaluations
The Smart Choice for Text Retrieval® since 1991
dtSearch.com 1-800-IT-FINDS




































































   53   54   55   56   57