Conditional Running

  • Thread starter Thread starter Peter Foot [MVP]
  • Start date Start date
P

Peter Foot [MVP]

You can check the System.Environment.OSVersion.Platform property. On Windows
CE devices this will be WinCE, other values will be returned when run in the
full framework on desktop windows machines.
e.g.
if(Environment.OSVersion.Platform==PlatformID.WinCE)
{
//do device stuff
}
else
{
//do desktop stuff
}

Peter
 
Felipe -

You can check the thread above ( Use .NET assemblies in compact framework ?)
regarding using the same assembly on both the PPC and the desktop. If you
want the same assembly to run on both (provided all references will compile)
at *run time*, you need to check System.Environment -- you could look at
OSVersion to determine what you were running on.

Also, your syntax (#IF) would make it a compile time decision what
environment would be targeted, so in that case System.Environment would not
be appropriate.

- K.
 
Hi,
I have a class that must use some functions for Compact Framework, and other
for DeskTop Pc:

#IF (IS RUNNING ON PPC)
Sub Insert()
'Insert in ppc
End Sub
Sub remove()
'Remove From PPc
end Sub
#ELSEIF (IS RUNNING ON DESKTOP)
Sub Insert()
'Insert in DeskTop
End Sub
Sub remove()
'Remove From DeskTop
end Sub
#ENDIF

There is a way to conditionally check for alternative functions if my DLL is
runing on Desktop PC or in PPC?

Thanks
 
Back
Top