New release of code samples from Microsoft All-In-One Code Framework (2010-11-05)

The code samples in Microsoft All-In-One Code Framework are updated on 2010-10-10.

Download address: https://1code.codeplex.com/releases/view/55110#DownloadId=163650

If it’s the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on YouTube https://www.youtube.com/watch?v=cO5Li3APU58 , or read the introduction on our homepage https://1code.codeplex.com/ , and this Port25 article https://port25.technet.com/archive/2010/01/18/the-all-in-one-code-framework.aspx .  

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

New ASP.NET Code Samples

VBASPNETBingMaps

This code sample shows how to use the Bing Maps API in an ASP.NET page. Sometimes we need to embed a map in our ASP.NET pages to locate a place and show the surroundings around the place. To achieve this task, Bing Maps API provide a map control. You can easily set the location, zoom level, display mode and other properties using only a few code.

CSASPNETAJAXConsumeExternalWebService, VBASPNETAJAXConsumeExternalWebService

When you request external web services by Ajax from client side, you may get the "Access Denied" error because of security issues. Web services do not allow cross-domain requests directly from the client. However, in many cases, we need cross-domain access to web services, then how to do? There are several ways to achieve it: If you visit the web service from outside the domain of your control, you can reference this from the server side, and then re-create a local web service to consume web services just quoted to visit the cross-domain services indirectly, which will be talked in this sample in details; if you can control the external web service, consider using JSONP directly from the client to consume cross domain web services or WCF services, MSDN has an article that discussed this method (https://msdn.microsoft.com/en-us/library/cc716898(VS.90).aspx).

 

CSASPNETShareSessionBetweenSubDomains

Sometimes we will publish a number of ASP.NET Web Sites on different Sub-Domains. We want these sites to share Session State, so that we can achieve one login and passing data etc. It seems that they are actually in the same site. This sample does demonstrating how to let two ASP.NET Web Sites share Session State on Sub-Domains.

New CLR and .NET General Code Samples

CSEnumerateAppDomains, VBEnumerateAppDomains

The sample demonstrates how to enumerate the managed processes and AppDomains using hosting API and debugging API. To identify whether a process is a managed process, you can check whether it loads CLRs using hosting API. If you want to enumerate the AppDomains in the process, attach a debugger to the process using debugging API.

CSMonitorRegistryChange, VBMonitorRegistryChange

The sample demonstrates how to monitor the registry key change event using WMI event. The change event will be raised when one of the following operations happened.

  • Rename or delete the key.
  • Add, rename or delete a sub key under the key.
  • Add, rename, edit or delete  a value of the key.

 

New Silverlight Code Samples

CSSL4DataFormCancelButton, VBSL4DataFormCancelButton

In this code sample, we create a data source with data item inherited from IEditableObject interface and implement BeginEdit, CancelEdit and EndEdit functions.  This will implement data reset functionality by pressing Cancel Button while editing on DataForm.

CSSL4DataGridGroupHeaderStyle

This project created a sample application, which illustrates how to define group header style of different levels and define group header style according to group header content in DataGrid Control.

CSSL4MEF

MEF(Managed Extensibility Framework) is a framework which could assist developers to design extensible application, it's supported by Silverlight 4. This sample utilize MEF to create a simple text formatter. By the predefined contract, user could create components to enhance the formatter’s functionality. The components could be loaded at runtime.

 

New Windows Workflow Code Samples

CSWF4CustomSequenceActivity

Generally, we use the built in Sequence activity to build a sequence workflow. Sequence activity is a composite activity. this sample demonstrated creating an customized composite activity: MySequenceActivity. and also
its activity designer so that you can use it in a workflow designer. If you are going to create your own WF4 activity, you can use this sample as a reference.

CSWF4LongRunningHost

In WF3, when a workflow is delayed and persisted in persistence store, after the timer expired, workflow will resume from database automatically. Now in WF4, we have to resume a persisted workflow manually, So can we create a long running WF4 that can monitor a delayed workflow and resume a workflow automatically after the delay timer expired? this sample include a host that can do this.

 

New Windows Shell Code Samples

CppShellExtThumbnailHandler, CSShellExtThumbnailHandler, VBShellExtThumbnailHandler


(thumbnail provider)

The .NET 4 code sample demonstrates the C# implementation of a thumbnail handler for a new file type registered with the .recipe extension.

A thumbnail image handler provides an image to represent the item. It lets you customize the thumbnail of files with a specific file extension. Windows Vista and newer operating systems make greater use of file-specific thumbnail images than earlier versions of Windows. Thumbnails of 32-bit resolution and as large as 256x256 pixels are often used. File format owners should be prepared to display their thumbnails at that size.

The handler implements the IInitializeWithStream and IThumbnailProvider interfaces, and provides thumbnails for .recipe files. The .recipe file type is simply an XML file registered as a unique file name extension. It includes
an element called "Picture", embedding an image file. The thumbnail handler extracts the embedded image and asks the Shell to display it as a thumbnail.

 

Download address: https://1code.codeplex.com/releases/view/55110#DownloadId=163650

If you have any suggestions, questions or feedback about this release, please email us: onecode@microsoft.com.