Cags Posted April 29, 2004 Posted April 29, 2004 I am currently working on a project that requires me to build several clients, each for differn't platfroms (i.e. a TabletPC client, a PocketPC client, a DesktopPC client). Now each of these clients will contain essentially the same custom controls, however the controls will need todo slightly differnt things depending on which platform its being used on (i.e PocketPC client needs to show the input panel when a textbox is selected). It seems pointless writing 3 sets of controls, each with only slight differences, so is there an easy(ish) way i can add code that will only run dependent of which platform it is on. The only other solution i can come up with is writing only one set of code, but using the c# syntax [Conditional("Platform")] and try to compile 3 seperate sets of controls. (i'm not sure if this will work yet, as i've not fully explorered it) Any suggestions? Quote Anybody looking for a graduate programmer (Midlands, England)?
*Experts* Nerseus Posted April 30, 2004 *Experts* Posted April 30, 2004 This is an untested theory, but might work: Can you code your controls in one library with any/all "common" code. Figure out the differences between platforms (drawing, specific function calls, etc.) and wrap all of the "special" cases as an abstract class in the main project. Then implement the 3 DLLs that each implement a specific version of the abstract class for each platform. The main project decides which DLL to load. You can have it "decide" based on a compile switch as well. I use the configuration manager to create new build types. Each of the new build types can define their own conditional compilation constants (in addition to DEBUG and TRACE). Then you can do a batch build in Visual Studio to build all 3 libraries at once, each compiles with a separate constant (and hence separate code). This will NOT work for separate references currently, as Visual Studio keeps the references in the project and not through a project property (which is where you can define differences between Build types). If you depend on different references, you'll need different projects. You can handle that through sourcesafe, potentially. Sourcesafe can share files - so you can have 3 unique projects with all files being shared EXCEPT the visual studio project file. Luckily, Whidbey has moved the references into the Project Properties area, so you can define different references per Build Type. Doesn't help you much right now though :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.