November 2010 - Posts

Windows Phone 7 comes with about 57 different input scopes you can use (there’s actually 62 or so, but 5 of them give an exception when loaded).  The two most important scopes are Text and TelephoneNumber.

  • TelephoneNumber gives you the numeric keypad when the user goes to enter text.
  • Text gives you word suggestions and smiley faces like in messaging.

     image     image

 

Setting these in code is a little convoluted. It’s a lot easier to simply set it in the XAML, eg:
<TextBox ... .. InputScope="Text" ></TextBox>

If you want to set the input scope in code, you need to construct an InputScope class instance, and add to it a InputScopeName class with the InputScopeName’s Value set to the InputScopeNameValue enum value.  It’s easiest to wrap this in an extension method:

   <Extension()>
  
Sub SetInputScope(ByVal textbox As TextBox, ByVal value As InputScopeNameValue
)
     
Dim scope As New InputScope
      scope.Names.Add(New InputScopeName With
{.NameValue = value})
      textbox.InputScope = scope
  
End Sub

Then setting the input scope in code simply becomes:

 TextBox1.SetInputScope(InputScopeNameValue.Text)

 

Some things to note about input scopes:

  • although you can cache an input scope, and assign it to a different textbox on an as needed basis, you have to be careful to ensure it is only assigned to one textbox at any given time. I doubt the memory minimization would be worth the effort.
  • an InputScope can have multiple InputScopeName values, but it seems like only the first one in the list is used.
  • the following InputScopeNameValue’s give a runtime error when run from the debugger:  PhraseList, RegularExpression, Srgs, Xml, EnumString

 

The main values you’ll want to use are:

value

description

Default

Standard QWERTY layout

Text

Standard layout with features such as autocorrect and text suggestion

Url

Standard layout with .com and customized Enter key for typing URLs.

EmailSmtpAddress

Standard layout with .com and @ key.

EmailNameOrAddress

Standard layout with .com and @ key, and easy access to phone number layout.

Maps

Standard layout with a customized Enter key. Used to type a location to search for on a map

TelephoneNumber

12-key layout

Search

Semi-transparent layout with a Search and .com key.

NameOrPhoneNumber

Standard layout with access to phone number layout. Used to type in the SMS To field

Chat

Text input that uses intelligent features such as abbreviations

abbreviated from http://msdn.microsoft.com/en-us/library/39D7932C-3E67-4142-9CCB-68843A571A66(v=vs.95,d=lightweight).aspx

As much as I like Windows Phone 7, there’s some really key areas that are missing. The following is my xmas wish list :

1.  Give me my compass back.

When I bought my HTC Mozart, I did so with the understanding it had a gps and compass.  On the HTC web site it says :

image

This illusion was even more exaggerated by so called navigation applications that actually show virtual compass dials: thing is they don’t work, and at best can only give you your course based on differential gps. When you’re on foot (especially in the Australian bush) that simply is not good enough.

So Microsoft, please give me access to my compass.

2. Provide Content Providers

Those of you who work with certain other phones, probably know what I am talking about when I say ContentProvider’s. It’s the broad ability for applications to share data/”content”. It’s the key programmatical interface missing in Windows Phone 7.

ContentProviders can allow access to the phone contacts list (with permissions); they can provide access to documents in the office hub; they can allow applications to choose whom they share data with; they can even provide a clipboard service.

3. Let me work with my PC

It really should be straight forward to connect the phone to my PC and put files on the phone. Today, unless you have exchange, the only way to work with documents is to email them to yourself. Skydrive, despite what some people may tell you, definitely DOES NOT synchronize office documents; it only synchronizes your OneNote. But even if they do fix skydrive, I shouldn’t be forced to copy documents over the web to get them from my PC to my phone and back.

One of the key reasons I went with Windows Phone was the belief that they would have great synergy with the PC. At present they don’t. At present it doesn’t even work well with the cloud, only exchange.  (again, perhaps the way to address this is via ContentProvider’s)

So please Microsoft, give me better PC to phone sync and synergy.

 

There’s more I could easily put on my list, but Christmas is coming soon, and I’m sure the elves in Redmond are busy working away at something. It’d be really nice if Microsoft addressed some of these, even in the form of an announcement and a time frame (and some CTP’s?); even better if they do it before Christmas.

Wow, seems Windows Phone 7 supports COM inside !  Chris Walsh has been doing some “investigating” into the inners of Windows Phone 7

Interesting, but also totally not usable in any production application.

If you’re like me and like to open reflector from the Visual Studio Tools menu, you’ll probably have noticed that you need to have a different configuration (or list) of assemblies when developing with Windows Phone 7. 

To make it simple to setup, I’ve attached a configuration file.

  • download the attached configuration and save it to a writeable path
  • In Visual Studio, click on the External Tools menu item (from the Tools menu), and add a new item:
  • set the command path the path to the full path of reflector.exe
  • make the Arguments:
    /configuration:"Full Path To config file\reflector_phone.txt"   $(TargetPath)

image

The HTC Mozart has an 8 mega-pixel camera built in. The following are some of the photos I have taken with it. All in all, I would say it is okay as a camera, but really it is a phone doubling as a camera.  Zoom is generally terrible and should be avoided.

But it can take some nice photos, and is handy if you left your real camera at home Winking smile

Flowers generally came up well:

 

Back-lit photos were reasonable: (I’ve seen worse)

 

Landscape photos weren’t generally that good. I had expected a lot more

Oversaturation was a bit of a problem:

 

Lots of pixilation,especially with the grass:

 

And digital zoom made an otherwise cute photo very pixelated:

 

it was difficult to control the lighting:

 

Luckily koalas are really slow, so I could move around the tree to get a better angle:

 

It’s here zoom would have really come in handy. Unfortunately it did a poor job, although the pixilation isn’t as bad as other cases:

 

Another picture of a kangaroo:

 

Again, zoom let me down:

 

Apart from the zoom pixilation issues, the occasional bit of over saturation, and a general shallow field of depth, it’s not a bad camera, but nothing to get excited over.

It is nice you can geo-tag the photos automatically using the phone’s GPS. 

One other disappointment is the “author” of the photos field is automatically set to “Hello from Seattle”, as some little Microsoft Windows Phone 7 joke come easter egg.  It’d be alright if they make it possible for you to change the default author field on the phone, but they don’t. As such, I find it kind-of rude for them to say they are the authors of the pictures I take: no other camera I own would dare to try to make such a claim.  There’s the hardware tag if they want to stamp their name. That’s another thing they really need to fix.

Yesterday I noticed that the Windows Phone content had been updated online, but my local help library didn’t have the new content. So I thought I’d just open up Help Library Manager and update my local content. Sadly it wasn’t that simple. Help Library Manager would only let me update the entire collection, a process it never managed to complete. Each time help library manager failed it would have to start all over again, again saying it had to download about 2 GB of files.

The solution : In the end, after a dozen or more attempts spanning most of the afternoon, I gave up and uninstalled all my existing help content. This allowed me to add back the books I wanted one by one and have them update when added.

The problem :  When the help library manager does its updates, it doesn’t allow you to select an individual book, instead it demands to update all books. And if any download fails, it aborts the entire process. The error message you get is:

clip_image002

If you look in the Windows Application logs (via Event Viewer), you’ll find error messages such as :

An error occurred while updating local content: Microsoft.Help.CacheLib.CacheLibDownloadException: An error occurred while the BITS service was transferring 'http://packages.mtps.microsoft.com/visual_studio_22759845_vs_100_en-us_6(e46593e9-d0e9-0b05-536f-729a38c64fa1).cab' to 'C:\ProgramData\Microsoft\HelpLibrary\content\Microsoft\incoming\36d8cf67-0d25-406f-8a5e-3b6143bc3769\Visual_Studio_22759845_VS_100_en-us_6.cab'. The error context was 'RemoteFile', and the error code was '0x80190194'.

Searching for 0x80190194 and Help Library Manager won’t bring you much joy (hopefully this blog post might change that).

A bit of an insight might be able to be inferred from the event log. It says the error occurred at :

at Microsoft.Help.CacheLib.DocumentationCache.<>c__DisplayClass6c.<DownloadWebContent>b__69(IGrouping`2 chunk)

at Microsoft.Help.CacheLib.Extensions.Each[T](IEnumerable`1 that, Action`1 lambda)

at Microsoft.Help.CacheLib.DocumentationCache.DownloadWebContent(IEnumerable`1 webDownloads, Int32 totalDownloads, Int32 completedDownloads, String workingDirectory, StatusCallback`1 statusCallback)

 

Note: I’m only guessing here as I haven’t seen the code, by my guess is there is no individual error handling in the Action lambda.  It’s a if one fails the lot fails approach. I always think this is something to be wary of with enumerable and lambda expressions. Simple lambdas look clean and elegant but often aren’t robust. The result is all or not at all.  And when that result is “not at all” most of the time, then we’ve got a problem.

So the workaround I employed was to limit the collection to start off with. This limited the “all” to a workable set.  But there’s lots more the team responsible for  the Help Library Manager should do (IMO).

  1. First thing to do is publish a KB and blog post about error 0x80190194, and let people know what is going on (and what the team plans to do about it) and suggest workarounds (like above).
     
  2. Fix the code. Add robust error handling that internally retries the download multiple times; and split it up so as the downloads that have succeeded are installed. Get over and get past the lazy all or not at all approach.
     
  3. Fix the UI. Apart from the antiquated fixed dialogue window (instead of modern resizable), the UI should allow updating of individual books (aka products).  If I want the latest Windows Phone documentation right NOW, I don’t want to be waiting until all the other updates apply.
     
  4. Provide downloads that can be installed offline. If you have multiple computers, you don’t want to be downloading 2GB for each one.
     

If you are editing XAML code in Visual Studio and seeing a lot of the code underlined as a hyperlink, the problem is you most likely have the “Enable single-click URL navigation” option selected.  It is best if you uncheck that option:

image

You can view PDC 2010 sessions online at microsoftpdc.com , but you can also download sessions to view later or copy over to your windows 7 phone Smile

The sessions info is all online in one nice big XML file :
http://videoak.microsoftpdc.com/pdc_schedule/Schedule.xml

Just scroll down or search for <DownloadableContent>

Or if you want you can run some XLinq on it to make it into a nice html doc. Here’s my quick and dirty attempt:

 Dim doc = XDocument.Load("http://videoak.microsoftpdc.com/pdc_schedule/Schedule.xml")

 
Dim sessions = doc...<Session>

 
Dim output = <html><body>
                  <%= From sess In sessions Select
                     <div><strong><%= sess.@Code %><%= " " %><%= sess.<ShortTitle>.Value %></strong>
                        <blockquote>
                           <%= sess.<FullDescription>.Value
%>
                          
<ul>
                              <%= From content In sess...<Content> Select
                                 <a href=<%= content.@Url %>><li><%= content.@Title %></li></a>
                              
%>
                           
</ul>
                        </blockquote>
                      </div>
                  
%>
             
</body></html>

IO.
File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder
.Desktop) &
"\session.html", output.ToString)