Windows Phone 8 Development Internals by Andrew Whitechapel & Sean McKenna
Author:Andrew Whitechapel & Sean McKenna [Andrew Whitechapel and Sean McKenna]
Language: eng
Format: epub
Tags: COMPUTERS / Programming / Microsoft Programming
ISBN: 9780735676206
Publisher: Microsoft Press
Published: 2012-10-28T16:00:00+00:00
Note
If you want to generate images on the fly, and you want to include transparency, you need to save your images in PNG format. However, this is not supported in the standard library. A solution that you can consider is the WriteableBitmapEx third-party library, which is available on codeplex at http://writeablebitmapex.codeplex.com/.
In this sample app, Page2 also has a TextBlock whose Text is set to a string that indicates whether the user navigated to this page via a pinned tile on the Start screen or via the HyperlinkButton on the MainPage. When you create a secondary tile, you can also specify the NavigationUri for the tile. This must include the page to which to navigate within this app, plus, optionally, a query string with whatever parameters you want. This sample app sets one ID parameter, which it uses subsequently to determine which tile this is. When you call the ShellTile.Create method, the tile is created with the specified properties and pinned to the Start screen on the phone. The Start screen is an app that is part of the system shell, so this action causes a navigation away from your app, which is therefore deactivated. The reason for this is to avoid spamming the Start screen: when you create a tile, the system makes it very obvious to the user that the tile has been created, and the user is shown where the tile is. She can then immediately interact with it, perhaps by moving it around, resizing it, or deleting it if she doesn’t want it.
There are two ways to get to Page2 in the app: through normal navigation via the hyperlink on the main page of the app, or via a pinned tile on the Start screen. So that you can determine which route was taken, you need to override the OnNavigatedTo method. This is where the ID parameter comes into play; the app can examine the query string to see which tile the user tapped to get to this page. This is also where you cache the ShellTile object. There’s only one secondary tile in this app, so you can cache this as a ShellTile field in the class. If there were more tiles, it would make sense to use a collection, instead.
protected override void OnNavigatedTo(NavigationEventArgs e) { String tmp; if (NavigationContext.QueryString.TryGetValue("ID", out tmp)) { navigation.Text = String.Format("from Start ({0})", tmp); } else { navigation.Text = "from MainPage link"; } tile = ShellTile.ActiveTiles.FirstOrDefault( x => x.NavigationUri.ToString().Contains("ID=" +tmp)); }
In this example, if the query string indicates that the user arrived at Page2 via a pinned tile, you simply extract the parameter value and display it in a TextBlock. In a more sophisticated app, you would use this identifier to govern some business logic in your solution.
Updating a tile’s properties and deleting a tile are both very straightforward. To update a tile, you simply find that tile and invoke the Update method, passing in a replacement set of data by using an object of the appropriate ShellTileData-derived class (FlipTileData, CycleTileData, or IconicTileData), as before.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Exploring Deepfakes by Bryan Lyon and Matt Tora(7784)
Robo-Advisor with Python by Aki Ranin(7677)
Offensive Shellcode from Scratch by Rishalin Pillay(6132)
Microsoft 365 and SharePoint Online Cookbook by Gaurav Mahajan Sudeep Ghatak Nate Chamberlain Scott Brewster(5077)
Ego Is the Enemy by Ryan Holiday(4968)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4444)
Python for ArcGIS Pro by Silas Toms Bill Parker(4205)
Elevating React Web Development with Gatsby by Samuel Larsen-Disney(3913)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(3666)
Learning C# by Developing Games with Unity 2021 by Harrison Ferrone(3287)
Speed Up Your Python with Rust by Maxwell Flitton(3235)
Liar's Poker by Michael Lewis(3232)
OPNsense Beginner to Professional by Julio Cesar Bueno de Camargo(3197)
Extreme DAX by Michiel Rozema & Henk Vlootman(3176)
Agile Security Operations by Hinne Hettema(3125)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic and Jasmin Redzepagic(3113)
Essential Cryptography for JavaScript Developers by Alessandro Segala(3084)
Cryptography Algorithms by Massimo Bertaccini(3003)
AI-Powered Commerce by Andy Pandharikar & Frederik Bussler(2990)
