Posts

Showing posts with the label wp7 emulator

Simple WP7 Mango App for Background Tasks, Toast, and Tiles: Code Explanation

Image
This is a continuation of this post , explaining how the sample app works. Caution : This sample isn’t meant as an example of best patterns and practices. If you see something in the code you would never do, then don’t. Solution File Organization The app has three Visual Studio Projects: the app, the agent, and the shared code library between them. One of the great things about Mango is that now the built-in Visual Studio Unit test functionality is available. By separating out the meat of the work into the SampleShared project, I can also focus my unit testing there. SampleApp1 The app has a MainPage, a ViewModel, and the WMAppManifest.xml file modified to note my ExtendedTask of BackgroundServiceAgent. The Agent is extremely simple with a call to the shared library, an update to the Tile, and a call to pop up Toast. The meat of the work is in the SampleShared library. The AgentMgr manages the background agent : add, remove, find, run now. It is only called f...

A Simple WP7 Mango App for Background Tasks, Toast, and Tiles

Image
Download Binary and Code The .XAP binary and code solution are both available for download . The app uses a background process that does some work then updates the tile and pops up toast. The app and the agent talk to each other via an isolated storage file protected by a named mutex. The diagram below shows the pieces and how they work together. This is the app associated with this post . App/Agent Architecture The app and agent don’t actually talk to a web service as this is a sample but in a real world solution they both would. The app would do the heavy lifting. The agent would have a quick, light conversation with just enough information to update the tile and pop up toast with meaningful information. In this sample, you can configure the agent to run repetitively every minute, second, etc. This is usually done for debug/testing. In the usual release situation, the agent runs on the 30 minute cycle. Start the App Pin the App to the Start Screen Make...

How to create a ChildWindow Login Popup for Windows Phone 7

Image
Introduction After struggling with a navigation issue in my app of when to show/go to/return from the Settings page that captured the user name and password, I decided to pop up a window on any page where and when credentials were necessary but not currently known. Since I knew I was going to add more credential-requiring pages in my app, using a popup allowed me to reduce my dependency on navigation silliness between the pages, and have a more encapsulated design.   This post will show you how to pop up a ChildWindow on the app page to grab the user’s login credentials. The control allows the old username and password to be passed into the control so that previous values can appear. The tab order/enter key switches from textbox to textbox to button.     The sample application included in this post just displays the results on the calling page.   Acknowledgements Several other posts helped me along the way:   Jesse Liberty’s video “C...

Windows Phone 7 (WP7) Default Color Codes

Image
These are the colors you will find in Settings | Theme | Accent Color:     Magenta – ff0099 Purple – 9900ff Teal – 009999 Lime – 99cc33 Brown – 996600 Pink – ff66cc Orange/Mango – ff9900 Blue – 3399cc Red – cc0000 Green – 339933   Thanks to Andy Robinson for pointing me to the correct tidbit about Mango .

WP7 Pivot’s TitleTemplate contains Title & Subtitle

Image
I tried to add to Textblocks to the Pivot':TitleTemplate and got an error "The property 'VisualTree' is set more than once." In order to work around this, I had to add a containing object (Stackpanel) that could contain both objects. In order to do that, create a TitleTemplate that contains a StackPanel with your Title and Subtitle Textblocks inside. The image below shows the Title and Subtitle above the pivot header. The XAML to produce this is below: 1: < controls:Pivot.TitleTemplate > 2: < DataTemplate > 3: < StackPanel > 4: < TextBlock x:Name ="TextBlockPivotDeploymentItemHeading" 5: Text ="Title" 6: FontSize ="20" 7: TextWrapping ="Wrap" /> 8: < TextBlock x:Name ="subtitle" 9: ...

Windows Phone 7 Emulator in a web page

Image
Lifeware Solutions is using the Windows Phone 7 emulator in a web page to demonstrate their windows phone 7 app. This is too cool to pass up. The web page looks like: The associated HTML code is: < object data= "data:application/x-silverlight-2," type= "application/x-silverlight-2" width= "432" height= "768" > <param name= "source" value = "DMSL/DeluxeMoon.xap" /> <param name= "onError" value = "onSilverlightError" /> <param name= "background" value = "white" /> <param name= "minRuntimeVersion" value = "4.0.50826.0" /> <param name= "autoUpgrade" value = "true" /> <a href= "http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style= "text-decoration:none" > <img src= "http://go.microsoft.com...