Jaime Rodriguez On Windows Store apps, Windows Phone, HTML and XAML
This is not déjà vu(or a joke) -- we are finally executing on the training event we postponed last November If you want to know why now, today Unity released their public beta of Unity 4.2, with support for Windows Store apps. The event is on; below, you will find the highest level details. For hour by hour agenda, check the registration site.
It is a 2 day event at Microsoft’s campus in Mountain View, CA. April 9 and 10. The event is optimized for existing Unity developers who want to get all the details on porting a Unity game to Windows Store or Windows Phone.
Agenda:
The event is free. If you can’t attend in person, you will be able to watch the presentations via live webcast at http://channel9.msdn.com. Again, you should register here. It is first-come-first-serve.
Hope to see you there. Happy Coding!
On December 13 and 14th, Microsoft and the Big Nerd Ranch team are having a two day training on building Windows Store apps. The event will be in Microsoft’s Mountain View (CA) campus. To attend in person, register at http://aka.ms/iostoWindowscamp Both days will also be streamed live at http://channel9.msdn.com
You can find a detailed agenda in the registration site. My no-fluff description for the event follows:
If you are an iOS developer, we hope you can join us, it will be a beginning of a fun journey.. Bring your Mac Book (with enough space to install Windows using parallels or any other virtualization technology).
To learn more about Windows Store app development, check out the resources for iOS developers page on the Windows Dev Center and check out Aaron’s Hillegass’ Build 2012 session: “Top 10 things iOS developers need to know about Windows Store apps”.
Happy Windows coding!
This event has been post-poned to a soon to be announced date (it will be end of January). Apologies for the inconvenience. Stay tuned for the new confirmed date details in the coming weeks.
Our Windows Evangelism team is partnering with Unity to put a great two-day workshop on building Windows Store games with Unity. The two-day event will be on Nov 29th on Microsoft’s campus in Mountain View, CA. To attend in person you will need to register at http://aka.ms/unitywindowscamp If you can’t attend in person, we will also stream day 1 live at http://channel9.msdn.com Day 1 will be instructor led content (again, streamed live) and day 2 is an installfest, hands-on, expert Q&A and coding. You can find a detailed agenda for the event at the registration site. There will also be a social event on Thurs night, and some other fun activities on Friday. Hope you can join us. If you want to learn more about building Windows Store games with Unity, check out their build 2012 session “Developing, deploying and monetizing Windows Store games with Unity”.
This coming Thursday (6/14) members of the Windows User Experience team are delivering an all-day, free, virtual training on Windows 8 UX fundamentals. You can register for the event here. Below is a brief excerpt from the registration site ( sorry for blatant copy paste )..
Metro style apps are the focal point of the user experience on Windows 8 Release Preview, and great Metro style apps share an important set of traits that provide a consistent, elegant, and compelling user experience. Join us for this free, virtual training presented by the Windows User Experience Team, which helps designers & developers learn how to design great apps that leverage the full extent of the platform and adhere to UX guidelines. After this training, attendees will understand the tenants of a great app, how to think about information architecture, best practices for designing flexible layouts, touch, how to leverage contracts in the platform, and much more. Agenda: · Metro style design · Commanding, Information Architecture & Navigation · Designing for Touch, Mouse & Keyboard · Animations · Designing for view states · Designing apps with adaptive layouts · Using Contracts · Connected and Alive · Anatomy of an App: Case Study We look forward to seeing you there. If you have any questions please email WUXFT@microsoft.com
Metro style apps are the focal point of the user experience on Windows 8 Release Preview, and great Metro style apps share an important set of traits that provide a consistent, elegant, and compelling user experience. Join us for this free, virtual training presented by the Windows User Experience Team, which helps designers & developers learn how to design great apps that leverage the full extent of the platform and adhere to UX guidelines. After this training, attendees will understand the tenants of a great app, how to think about information architecture, best practices for designing flexible layouts, touch, how to leverage contracts in the platform, and much more.
We look forward to seeing you there. If you have any questions please email WUXFT@microsoft.com
Happy Windows 8 Coding (and designing)!!
I have blogged before about the process to get a Windows 8 developer token early so you can reserve your name and submit your app.
Now, a few colleagues in US DPE Central region are raising the bounty with a contest that gives free slates to the best apps that complete a lab by June 30th. Get all the details at Jennifer Marsman's blog. By Microsoft’s definition, the states that comprise the Central Region of the United States are Texas, Oklahoma, Arkansas, Louisiana, North Dakota, South Dakota, Nebraska, Kansas, Minnesota, Iowa, Missouri, Wisconsin, Illinois, Indiana, Michigan, Ohio, Tennessee, and Kentucky)
Good luck & Happy Windows 8 Coding!
PS – Don’t forget, if you are not eligible to participate on the contest, you can still get the token by going to a lab around the world.
PPS – If you go to her blog post, leave a comment asking if JaimeR will be a judge at the contest. Let’s start the rumor and see if it sticks. I want to see the apps.
A few colleague evangelists are doing a series on MSDN Webcasts on building Windows 8 Metro style apps.. Catch the whole series and get a very concise, yet comprehensive introduction to building Metro style apps.. See below for abstracts and presenter for each session, click on the title for each session to visit the registration page for that session Each session is one hour.
Updated on 6/7 with new links to the off-line recordings since these are all in the past.
Monday May 14th, 2012 8:30 AM PST Introduction to the Windows 8 platform and the Windows store Jennifer Marsman Windows 8 is Windows re-imagined! Join this session to learn about the new platform for building Metro-style applications. Get an understanding of the platform design tenets, the programming language choices, and the integration points with the operating system and across Metro-style apps. We will also discuss the enormous opportunity for developers to make crazy money with the Windows Store. You will walk away with the resources to begin writing Metro applications for Windows 8.
Wednesday, May 16th, 2012 8:30 AM PST Designing apps with Metro style principles and the Windows personality Chris Bernard Metro style design has a set of five guiding principles to help you make the best choices when designing your app. These principles are the foundation for building great Metro style apps. Consider these principles as you plan your app, and always ensure your design and development choices live up to these principles.
Monday, May 21, 2012 8:30 AM PSTJohn WieseMonday, May 21, 2012 8:30 AM PST Monday, May 21, 2012 8:30 AM PST Building Metro style apps with XAML: What .NET developers need to know John Wiese
If you are experienced with .NET or Silverlight and are already familiar with XAML, this session will teach you everything you need to know to create a Metro style app for Windows 8. This session will cover updates to familiar features and explore concepts that are new for Windows 8. We’ll talk about building reusable Windows Runtime Components in C#, Async programming in Windows 8 and both the Visual Studio and Expression designers. This session will show you how to turn your XAML skills into money-making Metro style apps.
Wednesday May 23, 2012 8:30 AM PST What HTML developers need to know about coding Windows 8 Metro style apps Michael Palermo This session is perfect for any web developer wanting to leverage his/her skillset to develop Windows 8 Metro style apps. The session begins by proving how much web developers already know about building apps for Windows 8. The focus then turns to how to write JavaScript code with WinJS. Key points for Metro style app development will be highlighted by implementing popular feature requests using HTML5, CSS3, and JavaScript.
Thursday, May 31, 2012 8:30 AM PST Win as One: How Contracts in Windows 8 Help You Build a Killer Metro App G. Andrew Duthie Contracts are agreements between Windows and your Metro style app that allow you to integrate Windows 8 features into your app. For example, Windows 8 lets users share content from one application to another by using the Share contract.
In this session, you'll learn how contracts work and how to implement the built-in contracts such as Search, Share, Settings, and More. With Contracts, you can help users get more out of your app, and in a way that is consistent and intuitive, and they will reward you by coming back to your app again and again.
Monday, June 4th, 2012 8:30 AM PST Bring Your Windows 8 Metro Style Apps to Life with Tiles and Notifications Chris Bowen
Tiles and Notifications are important ways to draw attention to your app and improve your users' experiences. Tiles can draw users back into your app when your tile comes to life on Start screen. They can also let users personalize their Start screen by creating deep links to specific places within your app. Notifications, delivered through the Windows Push Notification Service, can inform and draw your users back into your app even when it's not running. In this session, you will learn how to effectively implement Tiles and Notifications to help your apps shine.
Wednesday, June 6th, 2012 8:30:00 AM PST Building Windows 8 Metro style casual games using HTML 5 David Isbitski
The intent of this session is to help HTML5/JavaScript developers with writing their first Metro Style App in a fun, immersive way. We will cover the basics of HTML5 Canvas gaming and how we can easily bring it to Windows 8. We will then add additional game functionality as we introduce HTML5 Audio, CSS3 styling and web fonts, implementing a game loop with JavaScript, 3rd party frameworks, touch, camera, accelerometer, and WInJS controls.
I will be watching. I hope you join us.
Happy WIndows 8 coding!
Two weeks ago, we announced an all day training for those Building metro style apps with C++..
Event sold out within a few days, and we got a lot of requests for it to be recorded (or broadcasted live)..
I am happy to announce that the event will now be live. Please pencil us in in your calendar. Event will be live on Friday May 18th, from 9 AM PST to 5 PM PST. We will share details (the link) and the agenda later this week. We will aim to have two live Q&As (one around noon PST) and one around 4 PM PST, we will take your questions via twitter.. Just follow the #win8C++Camp (Updated on 5/10) #ch9live hash on the day of the event..
Please help us spread the word!! Hope you can join us on the 18th.
Happy Windows 8 coding!!
Join the Microsoft Visual C++ and Windows teams in Redmond on May 18, 2012 for a free, all-day event focused on building Windows 8 Metro style apps with C++.
Whether you are a new C++ developer ready to learn about the writing Metro style apps, an intermediate developer who wants to hone your code and skills, or an experienced C++ developer eager to squeeze every ounce of performance out of your Metro style app and/or push the boundaries of Windows 8, then this event is for you. We will have pragmatic advice for every developer writing Metro style apps and games with XAML or DirectX and C++.
Registration: Register for this event here. If is first-come, first-serve, and we are limited in space, so register soon. If you want to learn more about other Windows 8 camps check the camps site.
Details: Location: Redmond WA, Microsoft campus, bldg 92. Date: May 18th, 2012 Time: 9 AM to 5 PM for sessions, Q&A and a small social event afterwards. Speakers: We will update the list of speakers early next week, we are still negotiating session times & speakers to cram as much as we can into a single day. Rest assured most of them are from the product team and yes, Herb Sutter will do the opening keynote and the first session. Meals: We will have some light breakfast, lunch, snacks and appetizers + drinks at the end of the day.
My personal pitch on this event: Even if you are already coding your Metro style app, you don’t want to miss this event. All the speakers are product team people, and we will have a very strong pragmatic angle during our sessions; we are aiming to answer a lot of the questions and help you avoid the common pit-falls that we have seen our early partners building Metro style apps with C++ have ran into. There will also be ample Q&A time through out the day. Happy Windows 8 coding. Please help us spread the word on this event we are really excited to connect with C++ community.
Tuesday, the Windows Store blog announced that in the next significant Windows 8 preview release they will be expanding their global coverage with 33 additional app submission locales for developers.
As Antoine Leblond alluded to in the post, our store services are ramping up as planned--and of course the plan includes ramping up developer registrations to enable app submissions to the Windows store. Today, you need an invite “token” to register. This begs the question - How can YOU get a token?
It’s easy! If your app is ready and you want to be among those developers who get to submit to the store early, simply attend one of the 100s of free Application Excellence Labs that DPE and Windows are holding around the world.
Follow these steps to get invited to an App Excellence lab:
Hopefully, there will be a lab near you. Right now, we have labs in 40+ countries and we may be adding more.
Of course, coming to the lab is not all you have to do. I have to go back to step #1: You need to have a compelling, functional app that follows our UX guidelines, our performance best practices, and our store certification requirements2
The lab is a 4-hour engagement with a trained Microsoft Services Engineer. This person will run your app through a series of tests based on a quality checklist to ensure your app is (or will be) in top-notch shape when you submit. You will also get a chance discuss ways to make your app even better and you will get answers to any questions you might have. If your app meets the criteria, then booyah! You get a token to register your developer account and (once you have been verified and all that) you will be able to submit your app to the Windows store. If your app does not meet the criteria, nothing is lost. You will still end up with a much better app3 and you will be able to submit it when registration opens for all developers.
Good luck. We are looking forward to seeing your apps and helping you to make them great!Happy Windows 8 coding!!
1 Kidding about the pledge but not kidding about highly recommending you review the guidelines and get your app very polished.2 Note: The lab is not a replacement for certification process; that still happens when you submit to the store.3 Really, the lab preparation will be worth it, you will have a survey with questions, useful advice, links to guidelines, etc. The survey is (by far) not the only criteria we will use at the labs, but if you follow the preparation from the survey, you will likely have a great app.
[I am traveling today, so it might be a one-off due to low band-width at the hotel, but in case it helps others]
I was installing Live writer and got a prompt to install the .NET Framework 3.5, I agreed to do that and got a “following feature could not be installed. Error: 0x800F0906.
Fortunately, I still had the ISO from when I installed consumer preview , so I used the local sources. If you see the error above, try this from an elevated command prompt.
dism.exe /online /enable-feature /featurename:NetFX3 /Source:h:\sources\sxs where “h” is the drive where you have your win8 installation files (or where the iso is mounted, replace the path appropriately ).
Happy Windows 8 coding!
Yesterday, Microsoft released the Beta Ad SDK for Windows 8.
This is an update to the SDK released at build. It works with Windows 8 Consumer preview.
Here are the relevant links for the announcement:
Happy Windows 8 coding.
it has been a long while since I last blogged. Why? I have immersed myself into the Windows 8 Metro style app development world.. :) Now, it is time to report back and share some of my experiences building Metro style apps via some blog posts. I hope you come along for the ride.Here is my list of "must know" links for anyone getting started with the Windows 8 consumer preview.
That should keep you busy through the weekend! Happy Windows 8 coding!!
Last week we did a video on background agents for the Inside Windows Phone show.. If you want to go deep into agents, you must watch the video. It is here. To lure the super starPeter Torr into coming and doing yet another video on background agents, I had to prove to him the questions were deeper than what had already been covered in his knowledge chamber video and on his blog post series on agents. This is the email thread with the Qs and Answers that we covered in the video. The email thread on questions ended up being (imo) a good way to document the details, so sharing it below as a supplement to the video - again, go watch the video now.
Full disclaimer: these are implementation specific details that might change in the future; or might even change under specific circumstances in Mango. Use them (as a developer) to plan and design a great experience, but in the end it is still a phone, so code safely. Q: How much memory does each agent get ? Peak working set is 6MB for periodic and idle agents. Note that the runtime takes > 2MB of memory, so your agent really gets < 4MB. When agents exceed the memory limit, even momentarily, they get terminated with or without an OOM exception (depending on whether OOM happened in managed or native memory). For periodic and resource intensive agents, the scheduling service will auto-disable agents that crash or OOM twice in a row. Note that RI agents are also run in RR cycles.
Q: How much CPU does each agent get? what can people do to not exceed it.. t is a different story for audio and generic agents. For Audio: the OS ‘guarantees’ that the agent gets ~10% of CPU time every 5s. Depending on the foreground activity, the agent can use more – the average CPU is not limited in most cases). Note that audio player and streaming agents share the same process and the resources (memory, CPU). For periodic agents, expect to get 10-20% CPU in real time use due to parallel execution: we run up to 5 agents in parallel when the phone is locked. This means an agent that uses L2S and networking and finishes in 15s may take more than 25s when run with other agents.
The CPU ‘guarantee’ here is 10% every 15s (which is rarely useful unless you are dealing with a foreground CPU-heavy app like IE). Again no CPU limit. When there is low CPU activity in the foreground, agents can use as much CPU as they need.
One way to present this is: agents and foreground experiences share the same priority but run with different thread quantum allocation that ensures that, in most cases, the foreground app gets at least 70% of the CPU time.
Q:. How often do generic agents run? Around every 28 minutes. See details below.
Q: What is the algorithm for generic agents? what is the battery threshold? Do they still run in battery saver mode? Periodic agents don’t run when battery saver mode is On. They also don’t run when the phone battery is low (<20%). RI agents can’t run until the battery is at least 91%. The periodic schedule is a little fuzzy to align with other scheduled network activities (for example email sync and push client keep-alive signals). It is scheduled to run every 28 minutes but the schedule can be invoked earlier in some cases (delta can be up to 10min). Also agents don’t run immediately after boot – they are delayed for ~30min.
Q: What is limit on # of agents in a phone? What error do devs get when that limit is reached? No limit for Resource Intensive. Max of one audio agent at a time. For Periodic the limit is phone memory dependent. On devices with limited RAM (under 384MB), it is 9 agents, otherwise it is 15. You get an exception when the limit is hit (you have to check the error string unfortunately).
FAQ on things you can or can’t do from background agent: Q:Can I pin a new tile? No.
Q: Can I update a pinned tile? Yes, and you can delete pinned tiles
Q: Can I instantiate UIElements (even if not in a visual tree)? For example to create an image? Yes, and you can probably also enable properties by adding controls to the ‘invisible’ RootVisual, e.g. with something like:((Panel)(Application.Current.RootVisual)).Children.Add(control); You can use this for example to render user controls in the background (e.g. to create dynamic tiles). Watch out for the memory impact though always aim for <4.5MB peak.
Q: Can I create sockets, files, etc. open database, etc.. Yes, with one caveat: RI agents cannot go over cellular connection. This means RI agents will need a wifi connection to use sockets. (The desktop connection is disabled when tethered for sockets in general, but that is more noticeable for RI agents).
Q: During debug, is it possible to run my agent more often than every 30 mins? Yes, use the LaunhForTest APIs; Peter covered this in the video.
Happy Windows Phone coding. I will be back in full swing soon.
With the Windows Phone (codenamed) Mango beta release, the Windows Phone team thrived to have great documentation and useful learning resources for WP7 developers. I think they did a superb job and given it came after MIX (and we had lots of great video content) the docs have gone unnoticed a bit, so I want to highlight a couple of these resources to make sure developers are getting the most out of these. Today, I will cover the documentation improvements and the new “Mango” training kit. <shortcut> If you rather watch videos, here are two that summarize this post:Luke Nyswonger, lead for Windows Phone online documentation does a video walk through of all the new stuff in the docs.Yours truly does a walk-through of tidy, one of the apps in the training kit. It is a scenario that we use for five labs: sql ce, background agents, tiles, background transfer, and reminders. </shortcut>
New Mango training kit: With the new Windows Phone training kit for Mango release, we did a few things different:
Here are some of the new samples you will find in the training kit:
Great improvements and additions to the documentation The documentation team also did a few things different.
Again, if you want to see a brief video of these changes, Luke will give you a walk through in this video With all the above changes, developers can find every thing easily, they get a very comprehensive (and deep) view into the features, and they can even have fun while doing it. Thanks to the doc teams (and the PMs that reviewed it ) for all this goodness; I am sure I missed some; if you find it, comment on it please (or write your own blog post about it ).
Happy Windows Phone coding! Don’t forget to read the docs.
I hope I am not the only person who did not know this (apologies if that is the case). <context> A few weeks ago while at an event in Finland, my emulator did not detect an orientation change during a demo. Some one suggested I restart the emulator, I did, and it worked (against my instinct). Today, I found out what’s going on. </context> <answer> When you use the Page Up/Page down button, the emulator let’s you toggle the Software Input Panel (SIP) on and off. Also when you use the Pause/Break button the emulator disables the SIP and let’s you enter text via your keyboard. All that works neatly as expected. I use that all the time. The part I did not know is that the emulator does not support orientation changes when the keyboard is enabled. This is all well documented in the keyboard mapping page: http://msdn.microsoft.com/en-us/library/ff754352(v=VS.92).aspx but I did not know. Not sure if it has always been documented and I missed it or it is new; either way, fooled me once.. but not again.. </answer> Happy Windows Phone coding (and don’t forget to read the manual now and then !!)
In my last post, I teased that system tray in Mango is now customizable and data binding friendly On top of that, the SystemTray now has a ProgressIndicator that you can use to replace your PerformantProgressBar and display progress on async operations.
Here is everything you need to know (or everything I know) about ProgressIndicator. It is a DependencyObject so you can data bind to it.. You can use these properties to customize and manage the indicator:
A few small quirks and tips :
The screenshot to the right shows you all of SystemTray’s properties in action. It has a white foreground and green background with 60% opacity, indeterminate progress indicator and (obviously) custom text in the indicator. You can turn everything on and off to see the impact as you tweak each property. It is all data bound; there is no manual setting of any properties. I am running on light theme with orange highlight. You can get the source from my skydrive.
Happy Windows Phone “Mango” coding.
A missing feature from Windows phone 7.0 was the ability to set the Background and Foreground color in the SystemTray. For branded apps (like Facebook) this was a problem cause the tray looked ugly, so most of these apps had to hide it, hiding important notifications (like clock, battery indicator ) from the user..
In Mango, you can finally set Foreground (of type System.Windows.Media.Color ), and Background (type Color too) on SystemTray. I hope that going forward, all apps start setting IsVisible=”true” on the system tray. There is no excuse now for hiding it any more. I just looked at the API and found two other nice surprises:
Of course, there is one more nicety in SystemTray (ProgressIndicator). I will share my code on that in the next post (hopefully tomorrow)..
Happy Windows Phone “Mango” coding!!
if you try using RichTextBox in the recently released Mango Beta tools, you might notice the control does not have a default control template applied to it. [That means when you try to use it, you will see nothing but not get an error either].
This is a known issue for the beta. To get around it, simply apply this current Style to the page (or the App.xaml) for your project .
<Style TargetType="RichTextBox"> <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}" /> <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="0"/> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Padding" Value="0" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="RichTextBox"> <Grid Background="Transparent"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{StaticResource PhoneHorizontalMargin}"> <ContentControl x:Name="ContentElement" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Padding="{TemplateBinding Padding}"/> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
Notice we are using an implicit style (yay for Silverlight 4 on the phone!! )
Another known issue with the current beta build is that images are not showing up in the rich textbox (they show up in the designer in Visual Studio/Blend )but not at run-time. This is also fixed in later builds. Still, the template above should be enough to get you rolling with RichTextBox.
Happy Windows Phone coding!!
Thanks to those that attended our all-day Mobile Day event in Helsinki. As promised, the content follows.
Thanks again for attending.
Happy Windows Phone coding!
With all the new coming features in Mango, I had to bring the show back.. Every Friday expect an episode or two between now and Mango’s RTM].
This week, we have two new episodes
Please help me get the word out on the show’s comeback. We have lots of good, deep!! content coming..
The past few days have been very exciting for Windows Phone developers:
I am very excited about the roadmap, but I am also jazzed about our success to date, so I thought I would let developers in the marketplace tell you about their successes today. Two weeks ago, a few developers participating in LG’s hAPPiness program were here in Redmond and I was invited to join them for an hour of “tips and tricks.” [Sideline, the hAPPiness program is a great offer that allows LG phone owners to download and keep 10 great free apps from their marketplace. It is a wonderful promotion for apps, and as a value-add to LG phone owners, apps will rotate over time, so you will be able to pick from far more than the original twenty selected to-date]. I was able to meet most of the developers, and was impressed with their excitement, passion, and eagerness to write new apps or improve their current ones. It was so cool that I asked if I could record them to show to our internal platform teams, who always get a rise out of seeing cool apps and hearing from developers. Here are my personal conclusions from meeting the group1:
Those were my conclusions; but you don’t take my word for it. Take time to watch the interviews below. [Disclaimer: We were focused on the developer’s stories. Though they all demo their apps, the crappy recording (me), the room (improvised), and our goal of keeping the chat to just a few minutes, did not do the apps justice. Check out the apps in the marketplace links below, and don’t forget, if you are an LG user, these are free for a limited time.
Thanks to all of the devs for playing along on such short notice and letting me share their recordings. Check out their apps--and good luck creating your own!
Foot-notes:
1 I have to emphasize these are my personal conclusions. Don’t over-generalize it to my employer or folks in the Windows Phone team. 2 I don’t want to spin the numbers and compare to Android (you can ignore that part or not, your call). I only refer to the article because they have independent numbers on how well apps some are selling.3 Again, the platform and phone have been rock-solid. The area where we have been less than stellar is the marketplace. I can assure you that the right people are listening; there have been a huge number of improvements, and there are more on the way. There are 8,000+ apps in the marketplace, so clearly it ain’t all broken; be persistent and keep pushing us. I will come back to the marketplace topic in a future post (hold me to this).
I received a few questions about this post, and the nodo bits that were released last week, some of the answers are worth sharing broadly.
About the UI guideline comment [this is the one worth the clarification] What is the UI guideline about not using TextBox in pivot/pano? Where is it documented? This is mostly a recommendation (similar to keeping panorama UIs simple and clean). It is not a formal guideline since it varies by app layout/scenario. As you know, panoramas and pivots do listen for touch gestures, and the guidelines have always said you should avoid controls that fight for touch (such as sliders, map, etc.); a textbox is a bit more dependent on the scenario: copy/paste is not the primary function of a textbox; it should come down to what the textbox does; if the app is filling a form and you have lots of textboxes, then I too would avoid putting them inside a panorama or pivot. On the other hand, if you have a scenario that mostly presents data and really shines in a panorama or a pivot but you need a textbox that fits well into the scenario (such as a search box), it should be OK to use. The new controls mitigate touch conflict a little, and as long as you position your textbox and the usage is appropriate, my early preview testing says it is OK. Will my app fail if I have a textbox in a pano? Again, no. This is not a requirement.
My app does not have a pivot/panorama. Do I need to recompile and resubmit? For the most part, you should not have to resubmit (if you don’t have textbox inside pivot/pano). The exception are people that were manipulating TextBox’s focus and selection. If you manipulate these, it is safe to test to make sure it all works.
if I don’t recompile, will I get copy/paste in my app? Yes. Without recompile and resubmit, your app will get copy/paste in updated phones, and the performance improvements will also be there. Will I get the performance improvements? Yes, these are also coming for free.
Details on the API Can I get programmatic access to the clipboard? Not in this release. Can I disable copy/paste? No. That would be awkward to the user.
What controls get copy/paste? TextBox, PasswordBox. WebBrowser control includes support c/p too (if you have textboxes in the HTML). TextBlock does not get it, but you can re-template a TextBox to look like a TextBlock (do make sure to set it read-only).
Will new features be added to the API in future releases (e.g. programmatic access or clipboard access)? Of course. This current update is mostly an OS release, that is why the Copy/Paste is not very platform focused; but expect improvements in future platform releases.
Of course I have also heard the question: When does the release go live? Unfortunately, I don’t know the exact date (and I am bad at guessing). You can leverage the developer tools today and recompile your app with the new pivot/pano and submit to the marketplace any time. You do not have to wait for the release. Don’t wait until date is announced and end up fighting the certification queues.
Two people asked on this post about communication between HTML and Silverlight, so I thought I would share broadly about the more 'advanced' techniques. [Don't be misled, advanced is still easy, just explaining all you can do].
Silverlight on Windows Phone allows you to host HTML content in a WebBrowser control. You get bi-directional communication between the control and the HTML content:
If you own the HTML page you are hosting, the infrastructure above is all you need to get anything done (since you can just add the javascript to communicate). If you don’t own the page you are calling things are slightly more interesting but still very doable – these are the scenarios that fuel this post –. These are the communication mechanisms I use when talking to HTML on a page that comes from a server that I can’t control or influence.
webBrowser.InvokeScript("execScript", "history.go(-1)");
// this will fail, it returns null // object height = webBrowser.InvokeScript ( "eval", "document.body.offsetHeight" ); // this works string height = (string) webBrowser.InvokeScript ( "eval", "document.body.offsetHeight.toString()" );
StringBuilder bldr = new StringBuilder(); bldr.Append("var script = document.createElement('script');"); bldr.Append("script.text = 'function cb () { "); bldr.Append("window.external.notify (\"this text was injected on the fly\");}';"); bldr.Append("var headNode = document.getElementsByTagName('HEAD'); "); bldr.Append( "if (headNode[0] != null);headNode[0].appendChild(script); ;"); bldr.Append("var element= document.getElementById('btn'); "); bldr.Append("if ( element != null ) element.onclick = cb;"); webBrowser.InvokeScript("execScript", bldr.ToString());
I am sure there are more techniques, but the combination of the 3 above has gotten me pretty far in communicating between JS and Silverlight. If you want to see the code above in action, download this sample.
If you want to keep up with Windows Phone on a more frequent basis, subscribe to my Windows Phone question of the day RSS feed.
If you have a Windows Phone application that hosts the WebBrowser control and allows or encourages the users to navigate within the WebBrowser control’s space, you are going to run into the 5.2.4.b certification requirement:
“Pressing the Back button must return the application to the previous page”
This requirement is easy to understand for PhoneApplicationPages; but for HTML, I am still undecided on how intuitive it would be to a user that is navigating inside a WebBrowser control. Most of the apps I have been involved with that use the WebBrowser control, do not encourage navigation ( they show small HTML inline) or show HTML it in a popup that only has a close button on the top right, so I have never worried about integration between WebBrowser and back button. It was always a “Back” closes the transient popup. That said, I saw a news reader app last week that had a full screen WebBrowser, and a back and forward button in the appbar, this felt weird ( to see a back button in the appbar) I thought the hardware back button should integrate with this “perceived” navigation stack . This got me thinking about 1) how hard it is to code and 2) how error prone it would be. Yesterday, I quickly threw in an HTML page that I felt would cover most linking scenarios. It has regular navigations (A HREF) , shortened URLs (that lead to redirects), navigates using script, and has fragment navigations. I then created a project with WebBrowser to integrate with back button.
Here is my one-hour exploration: 1) Listen to WebBrowser.Navigated event; keep track of the pages that have been visited.
Stack<Uri> history= new Stack<Uri>(); Uri current = null; private void WebBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { Uri previous = null; if (history.Count > 0) previous = history.Peek(); // This assumption is NOT always right. // if the page had a forward reference that creates a loop (e.g. A->B->A ), // we would not detect it, we assume it is an A -> B -> back () if (e.Uri == previous) { history.Pop(); } else { if (current != null) history.Push(current); } current = e.Uri; } 2) Listen to OnBackKeyPress on the page. If the WebBrowser has a navigation stack, cancel the backkeypress and navigate within the webbrowser control’s stack.
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) { base.OnBackKeyPress(e); if (!isPerformingCloseOperation) { if (history.Count > 0) { Uri destination = history.Peek(); webBrowser.Navigate(destination); // What about using script and going history.back? // you can do it, but // I rather use that to keep ‘track’ consistently with our stack e.Cancel = true; } } }
As you can see, code is trivial, but it has an issue I did not solve. I can’t tell the difference between:
I tried letting the browser do the work, and peeking at history.length (you can see the code in the sample, commented out), but that does not help since the sequence #1 above leads to a length of 2, instead of a length of 0. Since that does not solve it (and I don’t see a different way, is this good enough? I think it is, because:
Unless I missed another major gotcha, I think this does nicely. It is intuitive to the user in most typical navigations. It lets them out of the browser page (history.length was getting stuck since it never decreased to 0). I also asked internally to the Microsoft folks building apps, and the ones that integrate back button and webbrowser navigation are using the same pattern, and have not had any complaints from users.
To conclude, here is my personal advise/summary:
Sample code is here.
Yesterday, Kevin Marshall wrote a blog post with a good developer tip: to code defensively for the 15 application limit in push notification. I know the post was well intended (as a developer tip) and fair criticism (to platform limit); but a few people got confused or misinterpreted and we ended up with tweets or posts that said “Windows phone allows only 15 live tiles”, or “you must uninstall apps to free tiles”, etc.. Here are a few details you might care to know, so you can plan your app and be a good citizen:
To handle the error, as Kevin pointed out it is just a matter of listening for the exception, and right error message. Then prompt user to turn-off push notifications in another app. There is no API to list the applications using it – and I have not heard of a plan for this API –.
Is the limit too low, Kevin wonders. Obviously there is no perfect answer as it varies by user. I do know that the product team did research on types of apps, categories, how many a typical user would pin, enable push, etc. and they went with 15 for v1, so it is not an arbitrarily low number. I saw the data and it made good sense to me. I also hear that the limit can increase later, as we get more apps and better data. Full clarification, “can increase” only means we are constantly evaluation. it does not mean the next update will have this limit increased. Nothing to announce. Again, the key there is the planning was done for typical users. As developers, we tend to install more apps, and often enable the features just to try them out, but we are also power users that know when and how to turn these off. On the rest, we will have to trust (and hope) that the data the researchers and planners had for typical users holds us until the limit is increased. Why is there a limit? The usual thrive to ensure there is a great user experience, good battery life, quality of service on back-end and front-end, bandwidth (cost) , etc. Limit will increase as we get right data on how people use push, impact, etc. Kevin’s feedback on there not being an API to enumerate all push apps is still valid. I know the product team has heard it (from Kevin, me and others) so I hope that gets addressed or the limits go high enough that the problem becomes a moot point.
Hope that helps. My take, when it comes to push,