Archive for the 'WPF' category

Inside the HP TouchSmart PC software: HP SmartCenter - Part 4

April 24, 2008 7:33 pm

Hi! It looks like you're new here. Welcome! If you like what you see, I encourage you to subscribe to my RSS feed. If you're worried about adding another RSS feed that will add to your information overload, don't! I'm not a prolific poster. Thanks for visiting!

This is part 4 of the mini-series on the HP SmartCenter software. Hear about the team’s reaction to the Engadget leak and the launch plans at CES 2007. If you missed the first three parts, they are here, here and here.

One of the really unsettling events before the launch of the TouchSmart PC was that Engadget somehow got a hold of some pictures that had been prepared for the launch in early 2007 at the Consumer Electronics Show. It was billed in the first sentence as “AMD’s sweet new rig”, which was a little bit of a slap in the face, since most of the real work fell outside of AMDs realm. I remember the team meeting when our program manager came in and told us about the “leak”. He had heard it from Microsoft just a few moments before joining the meeting. The mood in the room instantly turned. People started feeling both mad at the leaked information (and the leaker) and depressed about the potential impact this would have on our launch at CES. Microsoft especially was disappointed, since the TouchSmart PC represented a big investment on their part, carrying some of the Vista messaging. The TouchSmart PC was to be billed as one of a few “dream” PCs at CES. Having gone through an experience like that, I now always think about how the people involved must feel when I see “leaked” information about upcoming products. It’s not fun to have it happen to you.

On a happier note, the TouchSmart PC seemed to make quite a splash at CES. At the last minute I was asked to attend the show to help with technical support on the show floor. This was my first time attending CES and going to Las Vegas, and I quite enjoyed the experience. I ran into quite a few of the people that had worked with us on the project, and it was fun to see the crowds milling about the TouchSmart PCs at the HP and Microsoft booths. Having backstage access was a unique thing, but it involved a lot of walking around, helping the people doing demos by making sure the software was installed properly.

Since then, the HP TouchSmart PC has received numerous awards (including spot number seven on PC World’s list of most innovative products of 2007) and for a short while even had a fan website, the HP TouchSmart Owner’s Club.

This is the tentative end of the series. If you’re curious about other aspects, let me know, and if I can talk about it, I’ll see if I can accommodate your curiosity.

Inside the HP TouchSmart PC software: HP SmartCenter - Part 3

April 17, 2008 7:30 pm

Welcome to part 3 of this mini-series. Last time around you heard a little bit about the early prototypes and how things progressed from there. This time I’ll talk a bit more about some of the functionality in HP SmartCenter and some of the things we were not able to address before having to ship.

The guiding principles for HP SmartCenter and the other touch-optimized applications were to provide quick, “transactional” experiences, to have the applications be as intuitive as possible to use, and have them look polished and clean. HP SmartCenter was to be the “home page” for touch-based interactions with the PC. It had to easily give the user access to key Media Center experiences (TV, music, games) as well as two other touch-optimized programs HP was developing (HP SmartCalendar and HP Photosmart Touch). Finally the user had to have the ability to add access to a certain number of programs of their choice.

To enable some of the quick, “transactional” experiences using a touch screen, HP SmartCenter had to have large “target” areas that are easy to hit using a finger. This requirement helped making decisions about the layout of the “tiles” that the user touches to “launch” something.

We wanted to highlight a few of the key features of the TouchSmart suite of software. We decided that three tiles would be larger than the remaining ones, and that those three would be able to show more details from the underlying program than the smaller tiles. The calendar tile, for example, will pull three upcoming events out of the calendar program and display key information about those events right within the calendar tile. The Photosmart Touch tile will look for pictures in the My Pictures folder and display five of those in a rotation. The weather tile will display high and low temperatures expected for the day as well as the current temperature as reported by the weather service. The analog and digital clock tiles will display two additional clocks (probably configured for different time zones) in text form, in addition to the main clock, which is shown in a larger, graphical look.

The three user configurable tiles would be able to either start a program on the system or a web page, using Internet Explorer. We settled on only having three configurable items, since there was an overall limit in the graphical design at nine small tiles plus three large tiles, and we wanted to encourage people to stick with tiles that didn’t take you out of a touch-optimized / touch oriented environment.

Beyond picking a software development technology (WPF), our other challenges were the many changes in both Windows Vista and WPF as both matured. WPF introduced “breaking changes” several times in our short cycle, and we discovered numerous problems with the integration of WPF and Windows Media Center. We worked closely with Microsoft to get these addressed. But a few problems remained, one of which is that every time you start one of the programs we developed, the computer screen will go black for a few seconds. It gives you the unsettling feeling that something went wrong, but it’s actually a consequence of the interactions between certain software components that are controlling the graphics card (DirectX, WPF and Media Center). As much as we didn’t like it, we were out of time to address these problems by the time our shipping date came.

That’s a wrap for part 3. Next time you’ll hear about the reactions from the team when information about the TouchSmart PC was leaked to Engadget way before the actual launch event, and I’ll also talk a little about the launch at CES 2007.

Update (2008-04-30): Part four is now posted.

Inside the HP TouchSmart PC software: HP SmartCenter - Part 2

April 10, 2008 7:12 pm

In the first part of this mini-series, I introduced you to the early planning stages of HP SmartCenter. This time you’ll get a little more information on the early development, including a few screenshots of prototpyes.

I hacked together a very simple first version of HP SmartCenter (then codenamed LaunchPad, which still is the name of the executable, incidentally) in HTML and my colleague Maguy added some rough graphical elements to give our design firm an idea of what we were looking for.

launchpad1.png
My quick HTML mockup

launchpad2.png
Improved graphics

From about February 2006 until April 2006 we then iterated with our design firm on the GUI and user experience design. Towards the end of May 2006 we took final delivery of the work from them. I was to turn their beautiful work into a living application with page navigation, drag-and-drop functionality, configuration options, and settings persistence. They had provided a solid foundation to build on, including well thought out namespaces, classes, animations and navigation design.

But there was still a lot of work to be done during the next three to four months. In addition to the application itself I was also responsible for delivering an installer, a supporting “touch optimization” program, and integration with our factory PC build process, including dealing with the “sealing” process that prepares the master hard drive for replication.

We participated in Microsoft’s early adopter program for Windows Presentation Foundation and Windows Vista, which gave us access to builds of the WPF bits, with a seemingly never-ending stream of Community Technology Preview versions. Windows Vista was in a similar state of flux, and I had my hands full, wiping out and reinstalling test machines and updating my developer machine to keep up with the changes.

At the same time I climbed the learning curve for WPF (which Simon Middlemiss once described as more of a cliff), trying to figure out how to get the mostly fixed-content XAML pages that the design company had delivered turned into malleable components and re-configurable layouts.

The initial design from the outside company included two components that pull information from the web: weather and stocks. We had to drop the stocks piece for business reasons early on, and had big challenges working out the business issues for the weather feed integration. We wanted our own high-quality images to illustrate the weather conditions and had to get approval from the owner of the feed data. I thought several times that the weather feature was dead, but stubbornness overcame pessimism, and we pulled all the right people from several companies together to get our images approved within 24 hours before the final code submittal deadline. I remember pulling a work-at-home weekend to fine-tune the weather feature where I had to stop working because I was hit with the flu. I was out for three days. After something like that happens you don’t give up a feature without a fight.

One benefit of being part of the early adopter program for WPF and Vista was that Microsoft arranged for training and troubleshooting sessions. I made two trips to Redmond under this program, once to get more in-depth training on WPF and Vista, and once to get help with troubleshooting performance issues we had run into. That’s when I learned that there is such a thing as a “managed memory leak“, which can be introduced in WPF without the programmer necessarily realizing it. Towards the end of the program three of my colleagues and I got to spend a couple of days with Microsoft again, this time at their Platform Adoption lab (Building 20), going over some last minute design and performance questions with their WPF developers one-on-one. This especially helped with getting HP Photosmart Touch into better shape for final release. We got a lot of tips and strategies for dealing with images, collections and containers in these sessions.

That’s it for part 2. Next time I’ll dig a little more into the guiding principles that were used for the implementation of HP SmartCenter, as well as some of the challenges and problems I encountered on the way.

Update (2008-04-30): Parts three and four are now posted.

Inside the HP TouchSmart PC software: HP SmartCenter - Part 1

April 4, 2008 10:23 pm

I thought some people might enjoy reading a little “behind the scenes” story about the most high-profile piece of software I’ve been involved with so far. I feel pretty lucky to have had the chance to work on a unique product and to have what I helped work on be so central to the user experience as it is on the HP TouchSmart PC. You may interpret this post as highly egotistical and self-centered, and I suppose it is. But I feel like telling a story. My story. I will go over most of the non-confidential details of the events as I remember them. Since there’s a lot to talk about, I’ve decided to split the story into a mini-series. This is part one. Here we go.

My involvement with the HP TouchSmart PC began in about December of 2005. The decision was made to invest in software that would be best suited for the touchscreen that the unit would have. One of the results is HP SmartCenter as seen here (screenshot from my developer machine, not necessarily representative of the final product):


We had tight deadlines. Our final bits would be due in about six months, around June / July 2006. Our product marketing folks decided they wanted the touch application to provide quick access to TV and music as primary features. Windows Media Center was our software of choice for delivering TV and music experiences, and so we made HP SmartCenter run within Windows Media Center. This helped to avoid waiting for Media Center to start up when the user wants to watch TV or listen to music. In other areas the choice created lots of challenges. The initial one was picking a software development technology.

I had just attended PDC05 and was pretty excited about Windows Presentation Foundation (WPF) and the speed I could sense it would give developers and designers for rapidly creating exciting software. I had learned that Media Center in Windows Vista would support WPF, and my recommendation to use it for our apps to make the deadlines while delivering a polished user interface was accepted.

An interface developed in HTML would not have had the same quality (read: look-and-feel). Using the Media Center Markup Language (MCML / SplashFX) was not an option, since that was not going to be revealed in any useful detail until about March 2006, way too late for us to learn how to use it and produce a product.

At PDC05, it had been mentioned that a well-know design company had worked on some XAML styles for the show. We approached them to help out with the application design and asked them to deliver their stuff as working XAML / WPF code. They were pretty excited about the idea and signed on.

That’s it for now. Check back soon for the next installment of this mini-series, where I’ll show you a few screenshots of very early prototypes.

Update (2008-04-30): Parts two, three and four are now posted.

Can’t install .NET 3.5 on Vista x64? Try uninstalling KB110806.

February 1, 2008 10:22 am

The title says it all. Several attempts I’ve made at installing the .NET Framework 3.5 on x64 Vista boxes failed with Error 1603. After a prolonged Google search, I found a forum with someone mentioning to uninstall KB110806, which seems to be related to .NET 2.0 SP1. I forget the forum and the details.

Anyway, if you’re having trouble with .NET 3.5 on Vista x64, try uninstalling the KB110806 update. I’m going to assume you know where to do that if you’re reading this.

WPF ControlTemplate Trigger tip

January 5, 2008 2:11 am

I didn’t fully realize how ControlTemplate Triggers work (or don’t) until I solved a problem with a UserControl today, with the help of this post on the MSDN forums.

A Triggers’ EnterActions or ExitActions don’t seem to get fired when a UserControl is constructed. If you want, say, an animation in your control to start on a property change, you can put a BeginStoryboard element into a Trigger’s EnterActions and a reverse BeginStoryboard into the ExitActions.

But for the control to start out right at initialization you also need to have the right Setter element on the Trigger to set initial states (in addition to setting the opposite initial states on the elements to be animated/initialized.)

Here’s a tiny example:

 1 <UserControl> <!– Namespaces omitted for brevity –>
 2   <Grid>
 3     <ToggleButton x:Name=”Toggle”>
 4       <ToggleButton.Template>
 5         <ControlTemplate TargetType=”{x:Type ToggleButton}>
 6           <Grid>
 7             <!– Initial opacity is 1 for the initially unchecked ToggleButton state. A trigger changes it to 0 for an initial checked state. –>
 8             <Grid x:Name=”HideMe” Opacity=”1″>
 9               <TextBlock Text=”Hidden”/>
10             </Grid>
11             <!– Other parts of the control go here –>
12           </Grid>
13           <ControlTemplate.Triggers>
14             <Trigger Property=”ToggleButton.IsChecked” Value=”True”>
15               <!– This setter hides the desired element when the ToggleButton’s initial state is checked –>
16               <Setter TargetName=”HideMe” Property=”Opacity” Value=”0″/>
17               <Trigger.EnterActions>
18                 <BeginStoryboard>
19                   <Storyboard>
20                     <DoubleAnimation BeginTime=”00:00:00″ Duration=”00:00:00.05″ Storyboard.TargetName=”HideMe” Storyboard.TargetProperty=”(UIElement.Opacity)” To=”0″ />
21                   </Storyboard>
22                 </BeginStoryboard>
23               </Trigger.EnterActions>
24               <!– ExitActions go here to make the Grid with the TextBlock visible again –>
25             </Trigger>
26           </ControlTemplate.Triggers>
27         </ControlTemplate>
28       </ToggleButton.Template>
29     </ToggleButton>
30   </Grid>
31 </UserControl>

The ToggleButton contains a TextBlock in line 9 that I want hidden when the ToggleButton’s IsChecked state is True. The animation in line 18 takes care of doing that when the user interacts with the control, but when the control is initialized, I need the Setter in line 16 to hide the TextBlock initially if the ToggleButton is checked by default (through data binding, for example.)

Introducing CardSharkV

November 25, 2007 1:06 am

Check out this program I’ve developed, called CardSharkV. It’s a digital picture storage card/camera “downloader” with a twist.

It’s a bit of an experiment, and I’m looking for some real-world “beta” testers. My plan is to try my hand at charging for the program. But to see if word will spread, I’m planning to give out 50 or so licenses without charge while I work out any kinks that might be in the program.

If you’re interested in trying it out, download the program, install and run it, and then click the “Request License” button.

Read more about it on the CardSharkV page.

Update (2007-11-25): CardSharkV depends on the .NET Framework 3.0. It’s thus meant to be installed on Vista systems only. If you have XP and the .NET Framework 3.0, it should still work. Also, since I posted the whole thing Saturday night after a whole day of re-shaping my first, never published version, I didn’t test the install too well. I’ve since had a little time to test and found some issues, especially with the license mechanism. I’ve posted version 1.0.2.0 to correct those issues and to improve the installer as well.

Microsoft deprecates support for XBAP WPF apps in version 5.3 of the Media Center SDK

November 19, 2007 10:02 pm

I downloaded and installed the latest version of the Media Center SDK just now, and was a bit surprised to see that WPF apps are now officially deprecated as a supported way of extending Windows Media Center on Vista. There’s no big announcement around this so far, it’s almost just a footnote in the “What’s New” section:

Deprecated features

The following features have been deprecated:

  • Hosting for Microsoft .NET Framework 3.0 Extensible Application Markup Language (XAML) browser applications (XBAPs).
  • The Triple-tap/Soft-keyboard ActiveX control for hosted HTML applications.
  • Support for using alternative shells to run and host HTML applications.

The reason I’m surprised is that Microsoft announced the support for WPF based extensibility apps at PDC05 with some fanfare.

I guess interest among developers just hasn’t been there for WPF-based Media Center apps, and Microsoft needs to make judgment calls on where to invest in their extensibility platform. The rest of the deprecated features seem to have been made for the same reason: limited interest among developers for these features. In addition I think there might be issues of an architectural nature that just make the three things that got dropped too expensive to maintain or improve.

I’m sad about this development, mostly because I still don’t see a great set of development and design tools around for MCML. WPF seems to me to have a whole lot more momentum than MCML (WPF has the Expression suite of tools and has been billed as the “GDI for the next 20 years”), but who knows what may be coming for Windows 7, or even an earlier interim update for Media Center?

Debugging XBAP applications on Vista using Visual Studio 2005

January 23, 2007 5:35 pm

I ran into an interesting little quirk with Visual Studio 2005 on Vista yesterday. I was trying to start an XBAP debugging session from VS (using the F5 key), and none of my breakpoints got triggered. Upon exiting the IE instance that hosts PresentationHost.exe, VS considered the session as still “running”.

I had set my system up according to Tim Sneath’s post on the perfect WPF developer system, including VS 2005 SP1 and the beta version of the Vista extensions for VS 2005. I was running VS “as administrator”.

As it turns out there are some technical details around starting XBAP debugging sessions from an elevated VS process that cause this behavior if you already have another instance of IE running when starting the debugging session.

Thanks to Tim Sneath and Chango Valtchev at Microsoft for helping in tracking this down!

Moral of the story: If you want to debug an XBAP from VS 2005 under Vista, run VS non-elevated, or make sure you have no other instances of IE running when you start the debugging session.

Localizing an XBAP application without using LocBaml

December 12, 2006 4:23 pm

Using the LocBaml sample application that Microsoft provides with the Windows SDK for Windows Presentation Foundation can be very frustrating. By default it seems to pick up a lot of things that clutter the resulting CSV file. If your application contains a lot of image resources, those will get duplicated in the localized resource dlls as well, increasing the space that your application occupies on the hard drive. And finally, getting an XBAP application to be deployable after localization with LocBaml requires opening up the application manifest and adding all the localized resource files to it. Otherwise a deployment error will bite you.

So with all those problems, we decided to take a different approach for our WPF XBAP applications. We put all our strings into a standalone XAML file, producing a ResourceDictionary. This way our application can pick up strings using Text=”{StaticResource strXYZ}” for XAML markup and/or use Application.Current.FindResource(”strXYZ”) for codebehind. We name the file “Strings_en-US.xaml”. We can localize this file nicely, and name the resulting set appropriately: “Strings_de-DE.xaml”, “Strings_fr-FR.xaml” and so on. These files can then be included as resources in the application. They can also be added as “loose” XAML files, so we can add languages or make corrections after compilation.

The string resource file looks something like this:



<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
>
  <sys:String x:Key="strButtonOK">OK</sys>
  <sys:String x:Key="strButtonCancel">Cancel</sys>
</ResourceDictionary>


At application load time, we look at the CurrentCulture and attempt to load the ResourceDictionary object like this:


ResourceDictionary rd = null;
System.Globalization.CultureInfo ci =
     System.Globalization.CultureInfo.CurrentCulture;
string langCountry = ci.Name;
string languageFile =
     string.Format("/Resources/Strings/Strings_{0}.xaml", langCountry);
try
{
  rd = (ResourceDictionary)Application.LoadComponent(
                              new Uri(languageFile, UriKind.RelativeOrAbsolute)
                                  );
}


You can imagine this with some catch {} fallbacks for when a specific language-country combination doesn’t exist. We’ll fall back to a file that’s only language specific, and if that doesn’t work out, we’ll fall back to en-US.

We’re not using CurrentUICulture, since that seems to be tied to the UI language of Vista, and we want our apps to follow what the user sets in Control Panel. CurrentCulture seems to work for that.

To load the strings into the global resource dictionary, we just do


Application.Current.Resources.MergedDictionaries.Add(rd);

To load loose XAML files that are not part of the application’s resources, we do something like this:


ResourceDictionary rd1 = null;
string languageFileLoose = string.Format(
         "pack://siteoforigin:,,,/Resources/Strings/Strings_{0}.xaml",
         langCountry
      );
Uri uri = new Uri(languageFileLoose, UriKind.Absolute);
System.Windows.Resources.StreamResourceInfo info;
System.Windows.Markup.XamlReader reader;
try {
  info = Application.GetRemoteStream(uri);
  reader = new System.Windows.Markup.XamlReader();
  rd1 = (ResourceDictionary)reader.LoadAsync(info.Stream);
}

Again, we extend this with catch {} blocks to fall back to a file that’s only language specific. We do the loose XAML loading after we’ve loaded embedded resources, so we can rely on a basic set of languages and strings, but can add languages, fix string translation errors or make improvements in the loose XAML after compiling things.

It may work for you as well, but ymmv.

Update: Changed the first Uri to UriKind.RelativeOrAbsolute

Close
E-mail It