Problem
Scenario 1:.NET Compact Framework provides System.Enviornment.SpecialFolder and System.Environment.GetFolderPath to get the path of any system directories. In my application I need the ProgramFiles path but it's not available in the SpecialFolder enum. What can the SDF do for me?
Scenario 2:I want to use the My.Computer.FileSystem.SpecialDirectories.MyDocuments but this is not available in CF. What can the SDF do for me?
Solution[Tested using Windows Mobile 6 emulator and Smart Device Framework 2.1]The Smart Device Framework provides the OpenNETCF.Environment2.GetFolderPath() and an OpenNETCF.Environment2.SpecialFolder enum. OpenNETCF.Environment2.SpecialFolder provides more values like ProgramFiles and MyDocuments which is not provided by the Compact Framework.
Sample Use:
string programPath = OpenNETCF.Environment2.GetFolderPath(OpenNETCF.Environment2.SpecialFolder.ProgramFiles);
string programPath = OpenNETCF.Environment2.GetFolderPath(OpenNETCF.Environment2.SpecialFolder.MyDocuments);
Here are the special folders supported.
public enum SpecialFolder { // Summary: // The directory that contains the user's program groups. Programs = 2, // // Summary: // The "My Documents" folder. MyDocuments = 5, // // Summary: // The directory that serves as a common repository for documents. Personal = 5, // // Summary: // The directory that serves as a common repository for the user's favorite // items. Favorites = 6, // // Summary: // The directory that corresponds to the user's Startup program group. The // system starts these programs whenever a user starts Windows CE. Startup = 7, // // Summary: // The directory that contains the user's most recently used documents. // Not supported in Windows Mobile. Recent = 8, // // Summary: // The directory that contains the Start menu items. StartMenu = 11, // // Summary: // The "My Music" folder. // Supported only on Windows Mobile. MyMusic = 13, // // Summary: // The directory used to physically store file objects on the desktop. Do not // confuse this directory with the desktop folder itself, which is a virtual // folder. // Not supported in Windows Mobile. DesktopDirectory = 16, // // Summary: // The Fonts folder. Fonts = 20, // // Summary: // The directory that serves as a common repository for application-specific // data for the current user. ApplicationData = 26, // // Summary: // The Windows folder. Windows = 36, // // Summary: // The program files directory. ProgramFiles = 38, // // Summary: // The "My Pictures" folder. // Supported only on Windows Mobile. MyPictures = 39, }
Powered by: newtelligence dasBlog 1.9.7174.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
E-mail
Theme design by Jelle Druyts