Orientation aware with Windows Mobile 2003??

Topics: Mobile Client Software Factory
Jul 13, 2006 at 7:54 PM
originally posted by: AdamB_

Hey all,

Can anyone please clarify for me whether it is possible to use the Mobile Client Software Factory orientation-aware forms with Windows Mobile 2003?

I just tried deploying the Hands On Lab #4 to the 2003 emulator and it complained of the following:

MissingMethodException was not handled.
File or assembly name 'Microsoft.WindowsMobile.Utilities, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35', or one of its dependencies, was not found.

Any ideas??
Jul 15, 2006 at 2:38 AM
originally posted by: dcazzulino

My bet is you will need to change the way the DisplayRotation event is hooked. The OAC is using Windows.Mobile.Status assembly, that may not be available/work on the Windows 2003 platform.
Jul 28, 2006 at 2:33 AM
originally posted by: eekvang


With help from this site:


we modified the OrientationAwareControl.cs file to only use 2003 available code.

Then we managed to create a Windows Mobile 2003 SE project that makes use of our new Orientation Aware dll file. But the problem is that it works only at runtime. We think Visual Studio uses the old designer dll which again tries to reference the old Orientation Aware dll. This obviously causes the designer to crash.

We also tried to build a 2003 class library from the designer code, but this code makes use of Windows Mobile 5.0 specific code.

Any suggestions?

Thank you.
Aug 1, 2006 at 12:22 AM
originally posted by: larsandreas


We made it work by copying all files from the original OrientationAware solution. Doing so made us aware of that the solution does alot of stuff 'behind the scenes' when being built, such as copying dll's and making the OrientationAware dll appear in the .Net tab in Add References. We've looked around, but can't seem to find out where to enter/alter such settings. Can anyone please tell us how to see them?

To make the block work with Windows Mobile 2003 we followed the tip and found another way of dealing with screen rotations. Instead of the original method, we listen for Resize-events and apply resources when it occurs. Does anyone see any reasons why this is a bad idea? It seems to work, but we don't think it's the most beautiful way of dealing with it :)


Lars Andreas
Aug 1, 2006 at 4:36 AM
originally posted by: dcazzulino

Hi Lars,
listening to the Resize event is fine, I think.

The "behind the scenes" stuff is done using standard MSBuild tasks that you can see if you unload the project in VS, and then right-click the unloaded project and select "Edit project file". That will show you the XML for the project (an MSBuild file). You will find a couple of custom entries in the AfterBuild target that perform the copying.

Aug 12, 2006 at 10:33 AM
originally posted by: Swain

Could you post your Mobile 2003 version here on gotdotnet or maybe email it to me? I am getting an error related to the OrientationAwareControl that I have in a Form in my app. It is erroring on the resources.ApplyResources(object value, string objectName) method. Has anyone else run across this? I have copied all of the mobile client software factory classes into my Windows Mobile 2003 project. Everything was working until I tried to actually impliment the OrientationAwareControl in a Form.
Aug 14, 2006 at 8:41 PM
originally posted by: eekvang


I have just posted our solution to the User Samples site. Hopefully it will be available for download within 72 hours.

Aug 21, 2006 at 10:18 AM
originally posted by: Swain

I downloaded and am attempting to use the 2003 compatible OA control, but I'm getting the same error I was getting when I tried to use the 5.0 version of the control. I get a NotSupportedException on the following line in my designer for my inherited OA control:

resources.ApplyResources(this.label1, "label1");

My project is setup using the standard Mobile Client Software Factory pattern. I used the guidance package to create the solution and to create the initial View. I then used the package to create an inherited OA control (changing the reference to the 2003 control). Everything works fine without the OA control added to the initial View, however, when I add it to the view, the designer adds the reference above that calls the ApplyResources method. This line is causing the NotSupportedException related to System.Drawing.Font. The actual error seems to occur at System.Resources.ResourceReader.LoadObjectV2().

Am I implimenting this wrong? The SampleOACApp works fine, but it is not using Mobile Client Software Factory views. Am I not going to be able to use this control with the full MCSF?
Aug 21, 2006 at 5:13 PM
originally posted by: dcazzulino

What precisely are you referring to with "2003 compatible OAC"? There's no official release of such a thing. The OAC included in the factory was designed and tested on WM5.0...
Aug 21, 2006 at 5:40 PM
originally posted by: Swain

I'm referring to the one uploaded by eekvang. He mentions it in the post above mine. It's available here:


Sorry for the confusion.
Aug 22, 2006 at 2:48 AM
originally posted by: eekvang

I have not experienced your problem, sorry. But I heard from another guy that he could not get the designer working with our modified OAC.
His solution was to create a Windows Mobile 5.0 project in Visual Studio, but use only 2003 specific code. Then the designer behaved as intended.

Let me know how it turns out..

Aug 26, 2006 at 8:43 AM
originally posted by: ThoreB

I'm the "other guy". (Actually Espen was summer student this summer in the firm I work for.) The tip I gave Espen didn't actually work. When I try using his version of the OrientationAwareControl I often get the error messsage shown at the end of this message. The control works fine when I create it, and work with it the first time. When I save the project and reload it I usually get the message. It doesn't matter if it is a 2003 or Windows Mobile 5 project. Frustrating since I really need this control in a project I'm working on.

I have done some reasearch and have found something. When I create a simple device application with one form that uses an OrientationAwareControl I never get this problem. When I use it in a class library I always seem to get it. Should I not use a class library? Should I put the controls in a control library? Another thing. If I first load the simple device application, and then loads the class library I don't seen to have this problem. This solves my problem for now, but I can't say I am very comfortable with this. Am I experiencing the managed version of DLL hell?

Ideas anyone?

Here is the error message I get:

Could not load file or assembly 'Visma.Mobile.Test.UI.OrientationAware, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

at Visma.Mobile.Test.UI.RootDesigner.Initialize(IComponent component)
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
Aug 28, 2006 at 11:19 AM
originally posted by: dcazzulino

I've logged this on our (Clarius) bug database for our upcoming product based on this. There are a number of other areas that could use an improvement.

Suggestions welcome!
And keep the bugs coming, we'll make our best to fix them.
Aug 28, 2006 at 8:18 PM
originally posted by: ThoreB

I have 2 improvment suggestions:

1. Windows Mobile 2003 support (I don't think I suprised you there)
2. Support for custom screen resolutions. I think it is very likely that there will be new resolutions.

Aug 29, 2006 at 1:53 AM
originally posted by: dcazzulino

1 - Yup ;)
2 - It's already supported :p. The control integrates with the built-in support for custom form factors, via the Tools -> Options -> Device Tools -> Form Factors options. That's explained in the HoL for the OAC, I believe. It's also explained in my weblog: http://clariusconsulting.net/blogs/kzu/archive/2006/07/05/ZeroCodeAdaptiveUIs.aspx
Sep 28, 2006 at 10:17 PM
originally posted by: ThoreB

Do you have any idea on when the version that supports 2003 will be released?