PC Review


Reply
Thread Tools Rate Thread

Better architecture for cross-platform project

 
 
Stefan Hong
Guest
Posts: n/a
 
      25th Sep 2004
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
 
Reply With Quote
 
 
 
 
Daniel Moth
Guest
Posts: n/a
 
      25th Sep 2004
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


"Stefan Hong" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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



 
Reply With Quote
 
Robert Levy [MS]
Guest
Posts: n/a
 
      27th Sep 2004
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.

Stefan Hong wrote:
> 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



 
Reply With Quote
 
Daniel Moth
Guest
Posts: n/a
 
      27th Sep 2004
Actually this question comes up so often that I have written a summary on
"Sharing code" between the platforms here:
http://www.zen13120.zen.co.uk/Blog/2...lframe_17.html

Hope it is of use to someone... the approach works great for us...

Cheers
Daniel


"Robert Levy [MS]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
> Stefan Hong wrote:
> > 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

>
>



 
Reply With Quote
 
Stefan Hong
Guest
Posts: n/a
 
      28th Sep 2004
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

Robert Levy [MS] wrote:
> 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.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Truly cross platform? Ray Cassick Microsoft Dot NET Framework 6 2nd May 2007 05:15 AM
Making a Cross-Platform Cross-Manufacturer Browser Plugin? Chris Shearer Cooper Windows XP Internet Explorer 3 17th Nov 2006 02:43 PM
NVIDIA's nForce Platform Processing Architecture - Windows XP ? dsouzan@gmail.com Windows XP General 4 30th Dec 2004 11:17 PM
Cross platform Koger Microsoft Dot NET 3 28th Sep 2004 08:11 AM
cross-platform Timothy V Microsoft Dot NET 1 23rd Aug 2003 09:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:16 AM.