Better architecture for cross-platform project

S

Stefan Hong

I am working on an application that will work on PC, pocket PC and
Smartphone. Obviously each platform must have it's own main Form
design, but I want to share program logic between them as much as possible.

I've searched the archive and found some ideas about using using
multiple project files for the same set of source files, but manually
maintain project file when adding/deleting source files is quite
error-prone, especially when it is maintained by a group of people.

Then I came up with an idea of creating an abstract class subclassing
System.Windows.Forms.Form for shared code, then creates separate
concrete class for each platform handling UI stuff. This sounds great,
until I realized that I can't use the nice form designer in VS.net
anymore. It only recognizes class subclassing from
System.Windows.Forms.From directly.

Is there any better idea to organize the project/code architecture?


Thanks,
Stefan
 
D

Daniel Moth

I don't think so...

Manually updating the two projects when adding/deleting files is not that
cumbersome as it may sound/seem at first... Especially if they are in the
same directory and you work in VS with "Show All files"

Cheers
Daniel
 
R

Robert Levy [MS]

My suggestion would be to put the actual functionality of your app into a
DLL and then creating 3 seperate projects for each platform - each of which
would simply be for a UI that leverages the shared DLL.

When creating the DLL, be sure to do it as a .NET Compact Framework project
so that the IDE still prevents you from using supported on the desktop but
not the device.

The only complication I've ever had with this approach is with having the
shared DLL call a webservice - the code generated for device projects to do
this doesn't work on the desktop.

--
Robert Levy
Program Manager
Mobile Devices Product Group
http://blogs.msdn.com/windowsmobile

This posting is provided "AS IS" with no warranties, and confers no
rights.
 
S

Stefan Hong

Actually I've already put all non-UI functions in a shared CF project,
and fortunately they don't use webservices so that works great. But for
UI part, there is still a great deal of code that could be shared, such
as the logic swapping content view in a form based on current context.

I recently came up with another idea. First making those code work in
an abstract way - manipulate on pure interfaces that represent visual
components in my app, then implementing those interfaces in concrete UI
classes in separate projects for each platform. But turns out this is a
bad idea 'cause I have to export too many things onto the interfaces
that making the entire project over-designed.

The current Configuration Manager has a 'Platform' drop-down setting but
does not allow us changing anything. Will it be supported in vs.net 2005?


Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top