SDF Sample: OpenNETCF.Environment2.GetFolderPath#

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:

Scenario 1:

string programPath = OpenNETCF.Environment2.GetFolderPath(
OpenNETCF.Environment2.SpecialFolder.ProgramFiles);

Scenario 2:

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,
}
5/22/2007 6:01:08 AM (Eastern Daylight Time, UTC-04:00) #    Comments [0]  |  Trackback

 

Another Year Another MEDC#

In the blink of an eye MEDC 2007 came and is gone.  If you could not make it to MEDC in Vegas then hopefully you can make one of the world tour dates.  Our sessions this year I thought went great. 

Chris' memory management session was standing room only so they decided to hold a repeat session the next day. 

My session was great also.  Thanks to the panel participants Scott Holden, Amit Chopra, Daniel Moth, Peter Foot, Andy Wigley, Chris Tacke and Alex Yakhnin.  (Unfortunately Neil could not be up on stage because there was not enough room and Richard Greenberg could not make it) Also, thanks goes out to the Compact Framework and Visual Studio for Devices teams who all showed up during the session to answer questions from the audience.  Also thanks to Rabi Satter who was able to answer some questions on Kiosk mode.

Other than tearing some ligaments in my ankle MEDC was once again great.  Some of the coolest things were the new features available in Compact Framework 3.5, Silverlight on Windows Mobile (see video here) and of course meeting with everyone again.

5/8/2007 5:02:07 PM (Eastern Daylight Time, UTC-04:00) #    Comments [0]  |  Trackback

 

MSDN Canada Code Awards#

I have been nominated for the MSDN Canada Code Awards in the Individual Developer category for my part in the Smart Device Framework.  I'm one of the top 5 finalists and the winner will be announced at the Energize IT event held by MSDN Canada.  If you like and or use the Smart Device Framework go and vote for me!  The amount of votes will help the judges in their decision who the winner will be.

5/5/2007 11:23:47 AM (Eastern Daylight Time, UTC-04:00) #    Comments [0]  |  Trackback

 

Smart Device Framework Discounts during MEDC 2007#

We are here at MEDC 2007 and we are having a two day discount on the Smart Device Framework Extensions for Visual Studio.  When adding the product add the following coupon code MEDC2007SDF and you'll get $25 off.

Hurry this is only until tomorrow!

5/2/2007 3:51:37 PM (Eastern Daylight Time, UTC-04:00) #    Comments [0]  |  Trackback

 

All content © 2008, Mark Arteaga
Related Sites
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 1.8.5223.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts