SmartCHART for the Smartphone

Saturday, November 12, 2005

A few weeks ago, I took the dive into Smartphones and bought an unlocked MPX-220. Even though the phone isn’t the latest and greatest gadget that some lucky people have, I’m happier with this phone than any phone I’ve ever had.

My first late-night project with the 2005 RTM build is a Smartphone 2003 application to scrape traffic information from the state of Maryland’s Coordinated Highways Action Response Team site. Hint: (if anyone is listening) – I could have built the app in half the time if the information was available from a web service or RSS feed.

traffic incidents speed sensor readings

Nothing earth shattering here: source and executable.

I wanted to use generics. I couldn’t understand why the compiler didn’t like the namespaces and angle-ly brackets until I read the manual. Smartphone 2003 SE projects only target CF.NET 1.0, which does make sense, if you think about it. No generics. Also, every other project type only targets .NET 2.0. I tried to put unit tests into a separate class library, but there were problems and I ultimately ended with NUnit tests inside the main executable ( #ifdef’ed away).

Daniel Moth’s post “Invoke CF and Full Fx” assured me I wasn’t going crazy thinking asynch programming on the compact framework is hard when compared to asych-ing with the full framework. Some APIs are missing (Control.InvokeRequired), and others are mutated (Control.Invoke is crippled). I skipped the asynch thing for now.

The emulator is a tad sluggish. I needed to install ActiveSync 4.0 for Internet connectivity from the emulator. I decided to switch to a Virtual PC to avoid a developer preview version of ActiveSync from hosing my machine. The error message that appears when trying to configure network settings for the emulator points to this page. The directions on the page are hidden and confusing, but ultimately take you to the Visual Studio for Devices blog post “Virtual PC Network Driver”. The post contains some good instructions (but also 11 broken images). No driver is needed - just ActiveSync 4.0.

Two issues I haven’t resolved:

1) Visual Studio 2005 deploys the kitchen sink to the emulator on every run. Even pre-installed assemblies like System.dll get shoved into the emulator, which makes for long waits during debugging. I did some searching and found some information that indicates this scenario shouldn’t occur, but didn’t find a definitive solution.

Update: By moving from NUnit 2.2.0 to 2.2.3 (the version that officially supports 2.0), the deployment problem went away.

2) I’ve been unable to scroll the CF.NET ListView control one “page” at a time. I’ve set FocusedItem properties, SelectedItem properties, invoked Update, invoked Refresh – nothing seems to highlight a new item X items away and moves focus to the item.


Comments
sivarv Tuesday, November 15, 2005
Hi Scott,

I am a dev working in VSD.

Regarding issue #1 in your blog post i am not sure that i understood your problem. In case if you are complaining that .NetCF is getting installed every time when you start emulator afresh, there is a way to avoid it. Please read my blog post which you might find useful.

blogs.msdn.com/.../468529.aspx

You can send me an email through my blog page for further communication.

thanks
Sivarv
Shabbar Tuesday, November 15, 2005
Hello Scott,

This is shabbar working as a dev in "Visual Studio For Devices" team in Microsoft.

Regarding Issue#1 : One scenario where it can happen is:

1. First create a VB control library solution.
2. Add a windows form to the project.
3. Change the project type to Windows application
4. Change the startup program to "Form"( Form you have added in step 2).
5. Open Build Configuration Manager and change check the deploy option for this project.
6. Now deploy the project.

All the Dll's will get deployed although they are not supposed to deploy.

The reason this is happening is because desktop version of System.Deployment.dll is getting added as a reference when we change the proj type to windows application (this is in vb desktop proj template). As a result it is pulling in other binaries also.

A simple workaround of removing System.Deployment.dll from the list of references,after that everything should work fine.

Please let me know @( shabbarh@microsoft.com)whether this works for you.And if it is not then please pass on the solution and project file(if you can).

Thanks
Shabbar
Sriram Krishnan Wednesday, November 30, 2005
I'm happy that removing the Nunit reference solved this issue for you. Posting this comment for any one in the future coming across this post.
Dan Kahler Friday, December 2, 2005
For the "scrolling" issue, try using the ListView.EnsureVisible(int index) method, the and ListView.Items[int index].Selected and ListView.Items[int index].Focused properties.
tramadol Tuesday, March 14, 2006
Good Site! Thank you for such sites! :)-tramadol hcl
tramadol hydrochloride
Comments are now closed.
by K. Scott Allen K.Scott Allen
My Pluralsight Courses
The Podcast!