A new release of Microsoft All-In-One Code Framework is available on May 27th.  The blog introduces the new code samples in the release.  Our new Sample Browser Visual Studio extension is also available now to facilitate your search of our code samples from within Visual Studio!

Code sample download address: http://1code.codeplex.com/releases/view/67076

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 Dynamics Code Samples

CSDynamicsNAVWebServices

Download: http://code.msdn.microsoft.com/CSDynamicsNAVWebServices-21bb94f1

This is the first Dynamics NAV code sample released in Microsoft All-In-One Code Framework.  Written by Lars Lohndorf-Larsen and reviewed by Jasminka Thunes - Microsoft escalation engineers in UK, this sample contains code for using Web Services with Microsoft Dynamics NAV.  The intention is to help Dynamics consultants understanding the syntax, and give them one place from where they can copy c# code needed to integrate to NAV via web services, instead of having to browse around for samples on various blogs and web sites. The project contains sample code for the following scenarios:

  • Invoking a NAV Codeunit
  • Creating an instance of a NAV Page
  • Read a full list of records
  • Read a filtere list of records
  • Read a single record
  • Insert a new record
  • Insert multiple new records
  • Modify a record
  • Modify multiple records
  • Delete a record

image

--------------------------------------

New Internet Explorer Code Samples

CSCustomIEContextMenu, VBCustomIEContextMenu

Downloads

C# version: http://code.msdn.microsoft.com/CSCustomIEContextMenu-3aa1c389
VB version: http://code.msdn.microsoft.com/VBCustomIEContextMenu-913227d7

The code sample shows how to customized IE context menu.  It demonstrates a custom IE context menu item that could open an image in a new IE tab.  The sample contains the following features:

  1. Adding Entries to the IE Standard Context Menu.
  2. Overriding the IE Standard Context Menu using Browser Helper Object.
  3. Deploy the custom IE Context Menu.

image

CSIEDownloadManager, VBIEDownloadManager

Downloads

C# version: http://code.msdn.microsoft.com/CSIEDownloadManager-8ab5d910
VB version: http://code.msdn.microsoft.com/VBIEDownloadManager-3287b087

The sample demonstrates how to implement a custom download manager for IE.  When IE starts to download a file, a custom download program (CS/VBWebDownloader.exe) instead of the IE built-in download manager will be launched to download the file.

image

------------------------------------------------------

New Windows General Code Samples

CSCpuUsage, VBCpuUsage

Downloads

C# version: http://code.msdn.microsoft.com/CSCpuUsage-f009d9c1
VB version: http://code.msdn.microsoft.com/VBCpuUsage-be7e2c94

The code sample demonstrates how to use the PerformanceCounter to track the CPU usage of the system or a certain process.  It shows the total processor time, the processor time of a certain process, and draws the CPU usage history similar to Windows Task Manager.

image

CSCreateMiniDump, VBCreateMiniDump

Downloads

C# version: http://code.msdn.microsoft.com/CSCreateMiniDump-7956a407
VB version: http://code.msdn.microsoft.com/VBCreateMiniDump-630c3f5d

The code sample demonstrates how to programmatically create a minidump when a .NET application has an unhandled exception and is about to crash.

When an application runs, it will launch a Watchdog process that can debug the application and subscribe the OnException event of the application. If there is an unhandled exception, the Watchdog process will create a minidump for the application.

The reason why we need a watch dog process is that MiniDumpWriteDump should be called  from a separate process if at all possible, rather than from within the target process being dumped. This is especially true when the target process is already not stable.  For example, if it just crashed. A loader deadlock is one of many potential side effects of calling MiniDumpWriteDump from within the target process. For more detailed information,  see http://msdn.microsoft.com/en-us/library/ms680360(VS.85).aspx.

Note:

  • This sample works for managed processes only, because it uses MDbg to debug the target process.
  • The watch dog process must be built with the same platform as the main application.

image

CSSoftKeyboard, VBSoftKeyboard

Downloads

C# version: http://code.msdn.microsoft.com/CSSoftKeyboard-0a86f914
VB version: http://code.msdn.microsoft.com/VBSoftKeyboard-161d92d7

The sample demonstrates how to create a soft keyboard, also known as on-screen keyboard or virtual keyboard. It has the following features

  • It will not get focus when a key button clicked.
  • If the user presses the left mouse button within its nonclient area(such as the title bar), it will be activated. When the left mouse button is released, it will activate the previous foreground Window.
  • When user clicks a charactor on it, like "A" or "1", it will send the key to the active application.
  • It supports special keys, like "WinKey" "Delete".
  • It supports the combination of keys, like "Ctrl+C".

NOTE: Ctrl+Alt+Del is not supported as it will cause security issue.

image

-----------------------------------------------------------------

New VSX and TFS Code Samples

CSCustomizeVSToolboxItem, VBCustomizeVSToolboxItem

Downloads

C# version: http://code.msdn.microsoft.com/CSCustomizeVSToolboxItem-ed17051f
VB version: http://code.msdn.microsoft.com/VBCustomizeVSToolboxItem-953058b9

If you add a new item to Visual Studio 2010 toolbox, the display name and tooltip of the new item is the same by default.  The sample demonstrates how to add an item with custom tooltip to Visual Studio Toolbox.

image

CSTFSEventListener, VBTFSEventListener

Downloads

C# version: http://code.msdn.microsoft.com/CSTFSEventListener-6dbeb03b
VB version: http://code.msdn.microsoft.com/VBTFSEventListener-02ca7c2f

The code sample demonstrates how to create a TFS event listener using WCF Console Application.

This WCF service is used to subscribe a TFS Check-in Event. If a user checked in a changeset which meets the filters of the subscription, TFS will call the Notify method of this WCF service with the parameters. The Notify method will display a message if the Changeset has policy failures.

 

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