Environment class
Provides properties to determine what runtime environment was used to open the form template.
Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)
Use the Environment property of the XmlForm class to access an Environment object you can use determine which runtime environment and program was used to open the form template for editing.
The Environment class provides the IsBrowser and IsMobile properties which enable you to determine what editing environment was used to open a form template. If both properties return false, the form template was opened in Microsoft InfoPath. If either property returns true, the form template was opened from an appropriately configured document library on Microsoft SharePoint Server 2010 running InfoPath Forms Services in the program for the corresponding property: a Web browser (IsBrowser property) or a mobile browser (IsMobile property).