Friday, June 30, 2006

Microsoft Bluetooth Stack

Peter Foot, who developed 32feet.net, has a list of Windows Mobile devices that use the Microsoft Bluetooth Stack (as opposed to, say, some 3rd party stack like the Widcomm stack whose SDK is cost prohibitive for most developers--and certainly most graduate students like myself).

Friday, June 23, 2006

.NET CF 2.0 SP1 Released

"Microsoft .NET Compact Framework version 2.0 SP1 release has been completed and is in the process of being released. This service pack was driven customer feedback including improvements in stability, adds new debugging features, extended platform support, and new developer functionality." (from .NET CF Team Blog)

Download it here.

Thursday, June 22, 2006

Sql Server 2005 Mobile

Astonishing as it now seems to me, I had not used SQL before integrating Sql Server 2005 mobile into my current project. That said, I occassionally run into these problems that could only happen to a SQL neophyte. For example, I've found out the hard way that naming your table columns either Trigger, Default or Option is a bad thing and confuses the hell out of SQL (and your development team members). Trigger, Default and Option, as I'm sure most of you know, are reserved words in Sql.

Tuesday, June 13, 2006

More ActiveSync Woes

I've had trouble with "cradling the emulator" in ActiveSync ever since I found out about this feature. In VS2005, open Tools->Device Emulator Manager. In the Emulator Manager, right click on a device and select "connect." Once the specified emulator has launched and loaded, you can right click on that device (again in the Emulator Manager) and select "cradle." This should cradle the emulator to ActiveSync so you can, for example, explore the emulator file system. However, this feature rarely works for me. Typically what happens is that after I select "cradle", the icon immediately changes (signifying that the device is indeed cradled) but ActiveSync does not respond. This seems independent of the "sit and spin" issue though as the ActiveSync icon does not change to green, nor does it animate at all. It simply stays gray.

Ah, ActiveSync, how you destroy my workday efficiency.

Update (07/12/2006 11:00AM): OK, thanks to Sriram's feedback (see Comments), I figured this out. Here are the steps (click on the images to see full size screenshots).

Step 1: Open Device Emulator Manager in VS2005 (Tools->Device Emulator Manager)
Step 2: Right click on your device of interest, start it.
Step 3: After the device has started, right click on the device again and select 'Cradle.' See Figure 1 below.
Step 4: The icon should change to represent that the device has been cradled. However, this does not necessarily mean that ActiveSync has actually connected to the device. See Figure 2 below.
Step 5: If ActiveSync has not actually connected to the device, yet the cradled icon is shown, open up ActiveSync, select File->Connection Settings. This will open up a Connection Settings Dialog. From there, click the Connect button. See Figure 3 below. This should find and connect your emulator device to ActiveSync.

Figure 1: Cradle the emulator

Figure 2: Emulator supposedly cradled

Figure 3: Open ActiveSync, click on File->Connection Settings. In the Connection Settings Dialog, click on the Connect... button. This should find your cradled emulator device.

Tuesday, June 06, 2006

Installation Error, Support Info: 4

I had problems deploying and running .NET CF 2.0 applications on my i-mate K-JAM (running Windows Mobile 5.0--OS 5.1.70). I posted this message to Google Groups:

I've been unable to successfully load a small test app I've written in VS2005 and .NET CF 2.0 (C#) for the i-mate K-Jam PocketPC Phone Edition.

The error that pops up on the K-JAM when deploying and debugging from VS2005, "Installation error. Stop all applications and processes and maximize available storage space, and run installation again. Support info: 4."

If I attempt to run the app by clicking on it in the file explorer on the K-JAM, I get the error, "This application (TestPocket.exe) requires a newer version of the Microsoft .NET Compact Framework than the version installed on this device." When I click details, I get:

TestPocket.exe
InvalidProgramException

I've tried this with the target device selected as both "Windows Mobile 5.0 Pocket PC Device" and "Windows Mobile 5.0 SmartPhone Device." I receive the same error in both cases.

Has anyone run into this before? I can successfully deploy my test app to the PocketPC and SmartPhone emulators as well as to the Cingular 2125 SmartPhones.

Mark Prentice replied with a pointer to a working solution at his blog:

I’m happy to report the workaround for the system failure, which will be included in SP1, has now also been slipstreamed into the current download. If .NET Compact Framework v2 CAB installation on a Windows Mobile 5.0 device fails with error #4 then this fix is for you. Just re-download the NETCFv2 package and re-install!

Here's a link to the .NET CF 2.0 download.

Sunday, June 04, 2006

.NET CF Menu Item Size

I'm developing an application that will be used by those with impaired vision and reduced motor control. Unfortunately, .NET CF makes it quite difficult to change font sizes for menus and menu items. In fact, MenuItem classes do not expose the Font property. In many instances, I avoid this problem because I run my application full screen--however, some messageboxes are run in "normal mode" with the menubars exposed.

Daniel Moth talks about a work around which involves modifying registry settings:

Menus (MainMenu, ContextMenu and MenuItem) are resized according to their Font. However, they do not expose a Font property, so you are stuck with whatever the default Font is for the platform. You can change that through the registry:

HKLM\Menu\BarFnt
DWORD "Ht" for height , DWORD "Wt" for boldness: 700 or 400

HKLM\Menu\PopFnt
same as above, but this applies to menu items rather than the menu bar

Friday, June 02, 2006

Params Keyword

The params keyword lets you specify a method parameter that takes an argument where the number of arguments is variable.

For example,

static void Main()
{
TestArgsMethod("Hello", " goodbye ", " hello");
TestArgsMethod("Numbers", 1, 2, 3, 4);
}

static void TestArgsMethod(String text, params Object[] args)
{
StringBuilder sb = new StringBuilder();
sb.Append(text);
foreach(Object o in args)
{
sb.Append(o.ToString());
}
Debug.WriteLine(sb.ToString());
}

Thursday, June 01, 2006

XmlReader and LineNumber

I made this post to microsoft.public.dotnet.languages.csharp but no one has responded, so I thought I'd repost it here. If you know the answer, please either leave a comment or respond in the newsgroup.

"According to the MSDN documentation within the XmlTextReader class for
.NET 2.0, the recommended practice to create XmlReader instances is
using the XmlReaderSettings class and the XmlReader.Create() method.
However, the problem is, the XmlReader class does not expose certain
properties that I need, e.g., LineNumber, LinePosition, etc. I would
like to follow Microsoft's recommended practices, but I'm not sure how
I can get XmlTextReader functionality out of XmlReader.

Should I instantiate a XmlTextReader object and pass this to the
XmlReader.Create() method and then access this underlying text reader
to obtain the info I need? Or is there some way to get the
XmlReader.Create() method to return a XmlTextReader object? Or should I
ignore there suggestion and simply create an XmlTextReader object
manually and not use the XmlReader.Create() method at all.

Thanks!"

Update 07/12/2006 @ 1:03PM: Zafar Abbas responded with a solution,

The reader obtained via XmlReader.Create supports the IXmlLinfInfo interface
from which you can access the line properties:

reader = XmlReader.Create (...)

IXmlLineInfo info = reader as IXmlLineInfo;
Console.WriteLine(info.LineNumber);
Console.WriteLine(info.LinePosition);

this should print your line numbers of the current node.