I have a Silverlight3 application that is meant to run on both Windows and Mac OS environments. I would like to know in runtime if my application is running on a Windows or Mac so I can tweak a few things to the way users are accustomed to in their operating system of choice.
For example, in Windows it is the norm to use "OK" "Cancel" buttons, while in Mac OS the norm is "Cancel" "OK" buttons (reverse order).
Any ideas?
There are two ways.
From Silverlight:
string os = Environment.OSVersion.Platform.ToString();
string version = Environment.OSVersion.Version.ToString();
From ASP.NET and send it to Silverlight:
StringBuilder sb = new StringBuilder();
sb.AppendFormat("UserAgent={0}", Request.UserAgent);
Xaml1.InitParameters = sb.ToString();
Not familiar with Silverlight, but I bet you can get hold of User-Agent
HTTP header, which includes OS name.