# Tuesday, June 22, 2010

Microsoft Surface Bluetooth Connect Code Sample

APPA Mundi recently worked with the Microsoft Surface team to put together a code sample showing the exchange of information from a Surface to a nearby Bluetooth enabled phone using standard protocols. This means that any phone which supports standard Object Exchange (OBEX) protocols can receive items from the Surface without installing any client software.

The sample code is available in the MSDN Code Gallery:-

http://code.msdn.microsoft.com/surfacebluetooth

This code sample is designed for use with the Microsoft Surface 1.0 SP1 SDK and makes use of the .NET Bluetooth library binary file available from http://32feet.codeplex.com. The sample code is provided "as-is" and is not supported. Alongside the standard functionality in 32feet.NET the sample illustrates using the notifications supported in the desktop Windows API and shows how to consume these from within a WPF application (the API uses native Windows messages).

#    |
# Thursday, June 17, 2010

New Book on .NETCF 3.5 Development

0102_MockupCover_0 Despite Windows Phone 7 Development being all-the-rage at the moment I was recently informed of a new book on .NET Compact Framework development. I’ll be reviewing it shortly, in the mean time you can check out the details (including a free chapter download):-

.NET Compact Framework Data Driven Applications

#    |
# Wednesday, June 16, 2010

DDD-Day Sydney 17th July

Following the format of the excellent Developer-Developer-Developer-Day events in the UK, Lewis Benge is organising an event on 17th July in Sydney. If you are in the Sydney area then I urge you to check out the website and register for this free event:-

http://www.dddsydney.com

As well as a range of .NET topics there will be a Windows Phone 7 session and labs.

#    |
# Monday, May 24, 2010

070-580: Windows Mobile 6.5 Application Development

This may be a little late to the party but I thought I would share some information on this exam. Because you sign an NDA when you take the exam I cannot comment on specifics of the exam content, however I can offer some guidance on the study guide:-

http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-580

This exam replaced the previous 070-540 exam which covered application development using Windows Mobile 5.0, .NET Compact Framework 2.0 and Visual Studio 2005. Therefore a large percentage of the material is the same between the two. The new topics come in the form of Widgets, LINQ, ADO.NET Sync Services and Windows Mobile Tools such as FakeGPS. The full list of skills measured can be read on the exam link above. There are a couple of oddities:–

  • The material is updated for .NETCF 3.5 by including LINQ but WCF is not listed.
  • ADO.NET Sync Services has never really been a core part of the development tools.
  • Finally one of the skills measured is creating a desktop installer for your application. There is not standard way of doing this but the guidance does exist (see list below) to put together a dll which acts as a custom install action within your desktop installer.

So once you’ve familiarised yourself with all the skills measured you’ll skip to the next tab on Preparation Materials and find there is nothing at all listed. Here is a list I think will help with your preparation:-

Microsoft Mobile Development Handbook – Microsoft Press. While the main book covers .NETCF 2.0 and Visual Studio 2005, the last chapter gives a run down on new features in Visual Studio 2008 and .NETCF 3.5 including LINQ. It ticks almost all of the Skills measured, there are a few articles which cover the new topics:-

Developing Widgets for Windows Mobile 6.5 – MSDN. The Windows Mobile 6.5.3 SDK added some support for Widget development to Visual Studio 2008 but I find it just hangs Visual Studio. This article shows the “old” approach from creating the HTML, JavaScript and building the ZIP file and renaming.

Programming Microsoft Synchronization Services for ADO.NET (Devices) – MSDN. Andy’s article describes Synchronization services from setting up and running synchronization through to optimisations for mobile use.

Using the FakeGPS Utility – MSDN.

 

The 70-580 exam is quite new and it is quite clear that if and when there is an exam created for Windows Phone 7 development it will by necessity be completely different. However for now 70-580 is the most up-to-date Microsoft exam for Mobility and is one of the requirements for the Mobility competency within the Microsoft Partner Program. Currently it doesn’t appear that there are any exams at all for Silverlight, but there are some coming in the next few months for .NET 4.0 and WPF.

#    |
# Friday, May 14, 2010

Microsoft English 1.0

More proof (if really needed) that Microsoft is abandoning English and making up its own language:-

"We have noted your concern and we have given your feedback to our upstream."

From Microsoft Subscriptions Support (TechNet/MSDN)

#    |
# Monday, May 10, 2010

Mobile In The Hand 4.2 Released

This latest update includes a number of performance enhancements and wider device compatibility.

A new SystemEvents class is added in the InTheHand.Win32 namespace which allows you to monitor power changes on devices which do not support the State and Notifications Broker (Pocket PC 2003 and all Windows CE devices).

InTheHand.Net.WebUtils provides a method to safely encode/decode strings in a HTML/XML friendly way.

InTheHand.WindowsMobile.Status.SystemState now supports more properties on Pocket PC 2003 and Windows CE devices by interfacing with lower level APIs on these devices.

This is a free update from v4.x. Registered users of v3.x can purchase a reduced price upgrade. Full product details here:-

http://inthehand.com/content/mobile.aspx

 

#    |
# Tuesday, May 04, 2010

WP7: Versions in April CTP

I was surprised when I first wrote a hello world application on the MIX CTP that the Environment.OSVersion.Version property was returned as 7.0 when all the media speculation was that it would be based on CE 6. I tweeted about it at the time but some sources are still saying that it runs a customised version of Windows Embedded CE 6.0 R3. However regardless of whether this is a version which pre-dates the eventual release of Windows Embedded Compact 7 (which will be the new name for the successor to Windows Embedded CE 6.0) and any other name changes (remember we have already had Windows CE, Windows CE.NET and Windows Embedded CE) I think it’s safe to say that the core OS in the product is version 7. As we already know Silverlight (and XNA) runs on top of the .NET Compact Framework 3.7 runtime. So just for curiosities sake here are the version properties retrieved in the latest April CTP release:-

April CTP Versions

#    |
# Monday, May 03, 2010

Configuring Microsoft Exchange Server for Mobility

If you want to learn about configuring Exchange Server for mobile devices there is an interactive configuration guide which will work through the actions required depending on your platform and your specific requirements:-

http://wmexchangesetup.com/launcher.aspx

#    |
# Saturday, May 01, 2010

WP7: Writing a Well-Behaved Threaded Application

The latest CTP release of Windows Phone 7 introduces a new managed library which exposes events you can monitor to catch changes in state in your application. The assembly is Microsoft.Phone.Execution.dll. This contains a WindowsPhoneEvents class which exposes two static methods – Pause and Resume. You can handle these events to detect when your application is dismissed and reactivated. This allows you to stop unnecessary processing and be a good citizen. I put together a simple example which shows how to pause a background thread based on these events and you can see the results by running it on the Emulator and switching to the home screen (Windows button) and returning to your application (Back button).

The sample uses a ManualResetEvent to block the background thread to avoid it consuming processor cycles while the app is paused.

WindowsPhoneThreading.zip (22kb)

 

Also in this assembly is the StreamPersister class. Unfortunately there is no documentation for this at the moment but an instance is passed in the Pause and Resume eventargs which will presumably allow you to safely persist state data which you can then load when your app is resumed. Hopefully there will be some official documentation on this to complete the picture.

#    |

WP7: New Capabilities Security Model

Jamie Rodriguez has a post on the new capabilities security model in Windows Phone 7 which is introduced in the latest CTP release:-

http://blogs.msdn.com/jaimer/archive/2010/04/30/windows-phone-capabilities-security-model.aspx

It is interesting to read how this will be handled at runtime, here are the key facts:-

  • If you try to use a feature and you didn’t specify the capability you’ll get an UnauthorizedAccessException when you first call that feature
  • There is no API to check if you have been granted a specific capability
  • The disclosure to the user will vary depending on the capability and marketplace – Either listed on the Marketplace page, a user prompt at purchase or a user prompt when the capability is about to be accessed.
  • A new project created in the latest CTP will request all of the currently documented capabilities (you can remove those you don’t need later)
  • There are other capabilities specific to OEMs and operators which are not documented
  • The table of example features lists a few items yet to be shipped in the developer tools giving an interesting insight into what is still to come – Microsoft.Devices.Radio and Microsoft.Devices.MediaHistory
#    |
# Friday, April 30, 2010

WP7: New CTP and a quick tip

If you haven’t already heard there is a new release of the Windows Phone 7 Developer Tools available which is compatible with the RTM release of Visual Studio. Before you install you need to uninstall the previous version and this is where you might have problems. See this tool for cleaning up your machine:-

http://blogs.msdn.com/astebner/pages/9544320.aspx

Okay, now you’ve safely removed the old bits you can download the new installer from here:-

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=cabcd5ed-7dfc-4731-9d7e-3220603cad14

Read the release notes:-

release notes

In particular there is a breaking change if you open existing projects – the WMAppManifest.xml requires some extra items to describe the application’s capabilities. There is also an issue with including Authenticode signed dlls (this includes official Microsoft libraries), you can read more about it here:-

http://timheuer.com/blog/archive/2010/04/29/windows-phone-tools-update-april-2010-silverlight-xna.aspx

Check out an overview of what is new in this release:-

What's New in Windows Phone 7 CTP Refresh

 

Finally to end on a quick tip – Assuming you install on a machine without Visual Studio 2010 the “Visual Studio 2010 Express for Windows Phone” displays a simpler user interface than its big brother. You can quickly enable extra goodness by going to Tools > Settings > Expert Settings. This enables more menu and toolbar options and is definitely worthwhile if you are already familiar with Visual Studio.

#    |
# Tuesday, April 13, 2010

WP7: ApplicationBar CTP Issue

If you have read the UI Guidelines for Windows Phone 7 (If you haven’t, get it now) you notice that in the discussion of the ApplicationBar it states that a maximum of four icons can be added. I noticed inadvertently that if you add five icons in your XAML your app will compile and run but only the first four are shown. If you add a sixth icon the designer will present you with an error:-

appbar6items

It appears that this is a bug in the current CTP release and the control should support only adding four items. It previously supported five but this was reduced based on user feedback, obviously the validation in the current CTP is not strict enough but I expect this will be fixed in the next release.

#    |

KIN: A totally different Windows Phone

Microsoft announced a pair of new phone devices which will be manufactured by Sharp and branded KIN. These are not part of the Windows Phone 7 platform but are still (perhaps confusingly) called Windows Phone. KIN uses a lot of the same underlying technology as Windows Mobile has in the past and Windows Phone will do, however the device is sharply focussed on social networking and the whole user experience revolves around this. The platform has built in support for Facebook, Twitter and MySpace along with the accompanying KIN Studio online service. KIN Studio is a web portal which aggregates everything you create on the phone up in the cloud. It has some cool visualisation of this content too including a timeline view of everything you’ve done. Think of it as a kind of MyPhone on steroids…

16_web

The user experience uses some of the same principles as the Metro user interface visible in Windows Phone 7 however one thing that is instantly noticeable is there is a lot less dead space. Where Windows Phone 7 uses large fonts and generous spacing in a “less is more” approach the KIN user interface packs highly graphical elements closely together. It has been described as a magazine style and certainly tries to catch your eye with everything which is going on in your social networks. Both platforms use a minimal colour scheme – from the flash based demo on the website you can choose one of four highlight colours but these are different to the colours used on the “big brother” Windows Phone 7.

I’m looking forward to seeing the real device, and I hope that some of these innovations (particularly KIN Studio) make it into Windows Phone 7 too! I’m also wondering if there will be any development story for these devices as there is nothing mentioned on the official website or press releases…

#    |
# Friday, April 02, 2010

Introducing "Windows Phone 7"

Microsoft have announced via Twitter that they have officially dropped the epic fail "Series" from the product name. Many have been referring to it as "Windows Phone 7" or "WP7" already and the "Series" was the latest in a series (sorry) of Microsoft adding redundant words to product names to unnecessarily confuse the public...

#    |
# Thursday, April 01, 2010

April Fools: More Details on Windows Phone 7 Cut and Paste Alternative

The news that Windows Phone 7 would release with no Cut and Paste functionality generated a lot of outcry but we were promised an alternative system which can recognise common information types and perform appropriate actions. The actual implementation was not demonstrated however some screenshots have emerged from an upcoming build featuring the “Content Assistant” which give an idea of how the feature will work in the final release. The design is based on extensive user research and experience of providing context aware functionality within other Microsoft products. The designers were keen to continue the friendly and personal design ethic which underpins Windows Phone 7.

“We wanted Windows Phone 7 Content Assistant to have a personality which users could really relate to and feel reassured that help was always on hand when performing common tasks” Avril Belachelijk – Senior User Experiences Ideator

The system will highlight recognised data such as phone numbers and the user can tap to see actions they can perform. The leaked screenshot is available here:-

http://mobileworld.appamundi.com/cfs-filesystemfile.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/peterfoot/assistant.png

#    |
# Friday, March 26, 2010

Audio Recording in WP7

Because it is possible to use the XNA libraries within a Silverlight project you can add audio recording in your application using the Microphone class found in the Microsoft.Xna.Framework.Audio namespace. You can test this on the Emulator as it will work with a microphone attached to the host PC.

First add a reference to Microsoft.Xna.Framework.dll to your project.

Next to make life easier add “using Microsoft.Xna.Framework.Audio;” to the top of your code file. You can access the Microphone through the static Microphone.Default property but for ease I created a local variable called m.

Next you need to decide what you are going to do with recorded audio. I built a simple audio memo application which stores the audio data in memory for instant playback. For simplicity I added MemoryStream to my app. I will write audio data to this and then I can easily get a byte array of the entire buffer to pass to the SoundEffect class to playback later. You could also write to a file in Isolated Storage or send to a web service…

In the constructor of my page I added an event handler for the BufferReady event of the Microphone. This is called each time the buffer is full and in the handler I copy the contents to the memory stream.

I created a Record button. I then set the BufferDuration on the Microphone object to 1 second (the maximum value), this is not strictly necessary as you’ll be copying data from the Microphone when it notifies you. Then I call Start to open the Microphone and start recording. Each time the buffer fills it is copied to the memorystream. When a Stop button is pressed I called Stop() on the Microphone to stop recording. Afterwards the MemoryStream is closed and we can now access the underlying buffer for playback.

A third button, you guess it “Play”, uses the SoundEffect class to play back the contents of the buffer. Into the constructor I pass the .ToArray() method of the MemoryStream, the SampleRate from the Microphone and AudioChannels.Mono since we know this is a mono source. You can then either call Play() or if you want to muck about with the sound you can use the overload which accepts volume, pitch and pan values. For example se.Play(0.7f, 0.5f, -1.0f) plays the sound at 70% volume, with pitch raised half an octave and through the left channel. Unless the user is wearing a stereo headset the panning will probably be lost on them. By playing with the pitch property (-1 – one octave lower through to +1 – one octave higher) you can probably find your perfect balance between Brian Blessed and Joe Pasquale…

As Rob Miles noted in his blog there seems to be an issue with pitch values > 0.6 in the current release.

#    |