A new release of Microsoft All-In-One Code Framework is available on July 13th.  We expect that its 17 new code samples would reduce developers’ efforts in solving the following typical programming tasks.

Download address: http://1code.codeplex.com/releases/view/69942

Alternatively, you can download the code samples using Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates.


If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, and read the introduction on our homepage http://1code.codeplex.com/.


New Windows Driver Kit (WDK) Code Samples

Bart Bartel (Microsoft Senior Escalation Engineer) and his great team members are continuing their efforts to ease Windows Driver developers’ lives with the customer-driven WDK samples.


Download: http://code.msdn.microsoft.com/CppVDSFormatVolume-c84cb6f2

This code sample demonstrates how to use Virtual Disk Service (VDS) to format volumes.  The sample takes the volume number and the target file system type as user input:

CppVDSFormatVolume.exe [-options]...
   -v <volume number (decimal)> REQUIRED INPUT
   -t <target file system type: NTFS, FAT32, etc.> UPPER CASE ONLY, REQUIRED INPUT
   e.g.: CppVDSFormatVolume.exe -v 3 -t NTFS

The sample project tries to find the volume based on the volume number, and format the volume with the specified file system type.

You should use this sample with care because formatting a volume may lead to potential data loss.  You can try out this sample with a useless USB drive.


Download: http://code.msdn.microsoft.com/CppVDSUninstallDisks-7192ea26

This code sample demonstrates how to use Virtual Disk Service (VDS) to uninstall disks and volumes.  The sample project takes the disk number as user input and performs a complete uninstall, including the dismount of the volume and uninstall underlying disks.

You should use this sample with care because uninstalling a disk may lead to potential data loss.


Download: http://code.msdn.microsoft.com/CppVhdAPI-4412d182

The code sample demonstrates various Windows 7 Virtual Hard Disk (VHD) API usage, such as VHD creation, attaching, detaching and getting and setting disk information.

The code sample must be run on Windows 7 / Windows Server 2008 R2 or newer.  The minimum supported client of the VHD APIs is Windows 7; and the minimum supported server of the VHD APIs is Windows Server 2008 R2.

The sample project takes the following commands as user input.




New Windows Azure Code Samples


Download: http://code.msdn.microsoft.com/CSAzureWebRoleIdentity-004bc8dd

CSAzureWebRoleIdentity is a web role hosted in Windows Azure. It federates the authentication to a local STS. This breaks the authentication code from the business logic so that web developer can offload the authentication and authorization to the STS with the help of WIF.

This code sample is created to answer a hot Windows Azure sample request: webrole-ADFS authentication with over 25 customer votes.


New Silverlight Code Samples


Download: http://code.msdn.microsoft.com/CSSL4SessionCookie-be844333

Written by Jon Burchel – a senior support escalation engineer in Microsoft, this sample demonstrates a simple technique to preserve ASP.NET session ID from a web page hosting a Silverlight component making a client WebRequest to another web page on the same site.  Normally, the WebRequest will not by default preserve session id, and this can be frustrating for a Silverlight developer.  But by appending the Session ID cookie manually to the request, passing it into the Silverlight component through a parameter on the calling web page, the session can in fact be preserved.




New Windows General Code Samples


Download: http://code.msdn.microsoft.com/CSTiffImageConverter-92ac2358

Created by Anand Malli, an Associate Consultant at Microsoft, this sample demonstrates how to convert JPEG images into TIFF images and vice versa. This sample also allows to create single multipage TIFF images from selected JPEG images.

TIFF (originally standing for Tagged Image File Format) is a flexible, adaptable file format for handling images and data within a single file, by including the header tags (size, definition, image-data arrangement, applied image compression) defining the image's geometry. For example, a TIFF file can be a container holding compressed (lossy) JPEG and (lossless) PackBits compressed images. A TIFF file also can include a vector-based clipping path (outlines, croppings, image frames).


CSHexStringByteArrayConverter, VBHexStringByteArrayConverter

C# version: http://code.msdn.microsoft.com/CSHexStringByteArrayConvert-a80e955d
VB version: http://code.msdn.microsoft.com/VBHexStringByteArrayConvert-be271820

This sample demonstrates how to convert byte array to hex string and vice versa. For example,

   "FF00EE11" <--> { FF, 00, EE, 11 }


CSImageFullScreenSlideShow, VBImageFullScreenSlideShow

C# version: http://code.msdn.microsoft.com/CSImageFullScreenSlideShow-79e29568
VB version: http://code.msdn.microsoft.com/VBImageFullScreenSlideShow-364ae534

The sample demonstrates how to display image slideshow in a Windows Forms application.  It also shows how to enter the full screen mode to slide-show images.




New ASP.NET Code Samples

CSASPNETControlPermissionForFiles, VBASPNETControlPermissionForFiles

C# version: http://code.msdn.microsoft.com/CSASPNETControlPermissionFo-8ed8306b
VB version: http://code.msdn.microsoft.com/VBASPNETControlPermissionFo-a67f4b12

The project illustrates how to control the permission for project files and folders on server, and protect them from being downloaded. Here we give a solution that when the web application receive a URL request, we will make a judgment that if the request file's extension name is not .jpg file then redirect to NoPermissionPage page. Also, user can not access the image file via copy URL.


CSASPNETFixedHeaderGridView, VBASPNETFixedHeaderGridView

C# version: http://code.msdn.microsoft.com/CSASPNETFixedHeaderGridView-9782c89b
VB version: http://code.msdn.microsoft.com/VBASPNETFixedHeaderGridView-7b359f7d

As we know, GridView usually has many rows with a vertical scroll bar. When users scroll using vertical bar, the header of the GridView will move and disappear. This sample illustrates how to fix the header of GridView via JQuery, and this approach can also cross multiple browsers at client side.


CSASPNETDisableScriptAfterExecution. VBASPNETDisableScriptAfterExecution

C# version: http://code.msdn.microsoft.com/CSASPNETDisableScriptAfterE-8bf228fd
VB version: http://code.msdn.microsoft.com/VBASPNETDisableScriptAfterE-7b6d469c

The sample code illustrates how to register script code at code behind and to be disabled after execution. Sometimes users who register scripts do not want them execute again, Actually they with to achieve this either in an automatic manner or by imitating an action for example, by clicking a link or button. This maybe due to functional purpose, user experience or security concerns.

CSASPNETShowSpinnerImage, VBASPNETShowSpinnerImage

C# version: http://code.msdn.microsoft.com/CSASPNETShowSpinnerImage-d7ac1552
VB version: http://code.msdn.microsoft.com/VBASPNETShowSpinnerImage-53ce1d10

This project illustrates how to show spinner image while retrieving huge amount of data. As we know, handle a time-consuming operate always requiring a long time, we need to show a spinner image for better user experience.



New TFS Code Samples

CSTFSWorkItemLinkInfoDetails, VBTFSWorkItemLinkInfoDetails

C# version: http://code.msdn.microsoft.com/CSTFSWorkItemLinkInfoDetail-d141169b
VB version: http://code.msdn.microsoft.com/VBTFSWorkItemLinkInfoDetail-e22ecdfd

The sample demonstrates how to get the link details of a WorkItemLinkInfo object.  The detailed information is like :

Source:[Source title] ==> LinkType:[Link Type] ==> Target:[Target title]

If you have any feedback, please fill out this quick survey or email us: onecode@microsoft.com