On MonoTouch I get the OS version with

UIDevice.CurrentDevice.SystemVersion


I think that MonoDroid maybe has something similar, since Windows Mobile and
Windows had too.

So maybe can be made something like that:

// To feign that is a System thing, if you like
namespace System
{
public string SOVersion()
{
#if MonoTouch
return UIDevice.CurrentDevice.SystemVersion;
#endif

#if MonoDevelop
return SomethingAndroidProvided;
#endif

#if WindowsMobile
return SomethingWindowsProvided;
#endif

// etc
}
}

MonoDevelop has ways to configure "profiles" that can have it's own pre
compile definitions if it's a shared project. Never tried on Visual Studio
but mane it does too. I use that to work with many enterprise certificates
for the same application and sometimes a special define must be done that
can't affect all version per certificate. So don't need to configure the
project all the time, just change de combobox.

On each SO version of the application I have one to specify the platform
since it must be the most possible cross platform, and
some-elegant-well-positioned #if makes the deal without messing the code.
For all systems you will do a:

Console.Writeline (System.SOVersion());

The inside #if will never be remembered again until the next SO/Mono
Framework.

Karl


From:  AnthonyLambert <[email protected]>
Date:  segunda-feira, 4 de junho de 2012 10:36
To:  "[email protected]" <[email protected]>
Subject:  Re: [MonoTouch] Runtime system identification?

As you wish to keep this API broken for backwards compatibility I guess
never
to be fixed. Could we have new extension API to get the "Brandname" of the
operating system which would be mono only?

So if the first call returns "Unix" or other mono type then we can call the
extension function to get more details eg.. what specific type of UNIX.
MacOsx, iOS, Android, Red Hat, or whatever.



--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Runtime-system-identification-tp46551
53p4655169.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch



_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to