A new release of Microsoft All-In-One Code Framework is available on November 1st. We expect that its 11 new code samples covering Dynamics NAV, Silverlight, ASP.NET, WDK would ease your development work in these areas
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 NAV Code Samples
In our Facebook page, and the feedback mailbox, we heard lots of customers’ voices for adding Dynamics code samples to Microsoft All-In-One Code Framework. People hope to learn Dynamics development through real-world code samples. Lars Lohndorf-Larsen and Jasminka Thunes – two Microsoft Escalation Engineers of Dynamics – championed for it. Thanks to their driving and supports, we are officially kicking off Dynamics code samples now. In this release, we have two new Dynamics code samples created by the two brilliant Escalation Engineers.
Use PowerShell & other techs to manage NAV Services (CSDynamicsPowerShellAdmin)
Created by Lars Lohndorf-Larsen – Microsoft Escalation Engineer of Dynamics, this code sample demonstrates how to uses PowerShell to list and manage NAV Services:
- List NAV Services
- Start and stop services
- Enter the name of a remote computer to manager NAV Services on that computer
The sample also uses xml to show and update CustomSettings.config.
The purpose of this sample is to illustrate how to use PowerShell and other technologies for managing NAV Services. It is on purpose developed to be just about useful as it is, but with lots of scope for further development.
The definition of a NAV Service for this purpose is a service where the name of the executable contains “Dynamics.Nav”, and it is assumed that any such service is a Dynamics NAV2009 middle-tier Service for connections from either RoleTailored Client or NAV Web Services.
How to boost performance on Dynamics NAV RTC reports
Created by Jasminka Thunes – Microsoft Escalation Engineer of Dynamics, this sample is an example that illustrates how to boost performance on RTC reports. This applies to reports that are printing confined record sets (normally anything under several thousands). The attached object shows how to correctly structure the report, where possible, so as to avoid sending any records that will not show at the print/preview on RTC.
In this example, report 1001 is modified so the dataitem used for calculation and print of footer values only (Value Entry) is removed. Footer is replaced with separate dataitem of type integer, and calculation of the values it will show is done in OnAfterGetRecord trigger of the parenting dataitem.
New Silverlight Code Samples
UDP multicast client in Silverlight (CSSL4UdpAnySourceMulticastListener)
Created by Jon Burchel – a senior support escalation engineer on the user interface team at Microsoft, this Silverlight code sample demonstrates the use of the UdpAnySourceMulticastClient, sharing messages between as many clients as may broadcast on the same port (8888 in this code sample). Open multiple instances of the webpage from any machines on a network supporting multicast (or locally on a single machine) to try it out. In order for multicast to work from Silverlight, there must exist a MulticastPolicyServer on the network. Each message is identified by its client’s session ID associated with the web site from where the Silverlight application was loaded. This sample exposes a simple console application, which runs when it is debugged, to expose such a server. The code for this server is available as part of this Silverlight SDK, here included as a single binary referenced in the console application.
Session continuation from ASP.NET to Silverlight (VBSL4SessionCookie)
This is the VB.NET version of Jon Burchel’s “Session continuation from ASP.NET to Silverlight” code sample. You can find its C# version here. 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.
Use Silverlight fragment navigation to perform a search (VBSL4FragmentSearch)
This is again the VB.NET version of Jon Burchel’s “Silverlight Fragment Search” sample. It has a very simple implementation demonstrating the use of fragment navigation within Silverlight to perform a search. This allows users to save a URL and return immediately to their search location later using a link. Of course, the fragment can be used in many other ways to track state, not simply to provide a search, but this shows the usefulness of the technique to preserve state within Silverlight using fragments.
A sample music player supporting playlist in Silverlight (CSSL4MusicPlayer, VBSL4MusicPlayer)
C# version: http://code.msdn.microsoft.com/CSSL4MusicPlayer-069bbbf8
VB version: http://code.msdn.microsoft.com/VBSL4MusicPlayer-06d1bbce
Created by Arwind Gao – our sample developer, the project demonstrates how to create a music player supporting playlist in Silverlight. User can upload some music files in Web application and generate xml file, the xml file includes some useful information of music files.
New WDK Code Samples
Sample StorPort Virtual Miniport (WDKStorPortVirtualMiniport)
Created by James Antognini – Microsoft Senior Escalation Engineer of WDK, this code sample is a StorPort virtual miniport that presents the appearance of 1 or more Fibre Channel Host Bus Adapters (HBA). Under an HBA, the sample creates LUNs/disks, which can be formatted and used by a file system such as NTFS.
A StorPort virtual miniport is much like a StorPort real miniport. A virtual miniport differs in several ways:
- The virtual miniport does not control hardware in a way supported by StorPort. It may conceivably control hardware by other means.
- Since there is no StorPort support for hardware control, the miniport does not use DMA or DMA operations (via StorPort APIs, that is). There is no Interrupt object or lock.
- The miniport can employ any API documented in the WDK for WDM drivers.
A virtual miniport is like a real miniport in important ways:
- StorPort as port driver handles PnP and power operations.
- StorPort supports the handling of other I/Os with the miniport’s support (through callbacks). That handling makes it possible for miniport-provided LUNs to be handled much as any other disk might be handled, including having a drive letter, mounting a file system and doing open, read/write, close and other kinds of I/O.
- StorPort handles the details of I/O queuing when and as needed (e.g., queue depth, pausing, resuming).
- Along with ClassPnP, StorPort can retry I/Os.
The sample assumes some familiarity with StorPort miniports. Sample documentation is minimal, consisting of this file and of comments in the sample’s buildable files. The WDK should be studied for more information about miniports.
New ASP.NET Code Samples
ASP.NET load globalization resources from assembly
C# version: http://code.msdn.microsoft.com/CSASPNETGloablizationInAsse-61b88691
VB version: http://code.msdn.microsoft.com/VBASPNETGlobalizationInAsse-212f017d
The code sample demonstrates loading embedded resources in an assembly based on the culture information, and use it to globalize the entire ASP.NET website. You will learn how to access resource files that has compiled in class library or dll file in ASP.NET. We give an effective way to get specific resources from compiled file and then apply resource value in whole application.
Customized DropDownList.SelectedValue (CSASPNETSmartDropdownlist, VBASPNETSmartDropdownlist)
C# version: http://code.msdn.microsoft.com/CSASPNETSmartDropdownlist-3e433291
VB version: http://code.msdn.microsoft.com/VBASPNETSmartDropdownlist-42251b98
The code sample customizes the SelectedValue property of ASP.NET DropDownList control so that it handles the situation more nicely when the SelectedValue property is set to a value that does not exist in the DropDownList value collection. By default, an ArguementOutOfRangeException exception is thrown when SelectedValue is set invalidly. With the customization, the DropDownList will select a “None” item when the SelectedValue is invalid.