Microsoft All-In-One Code Framework 2009-12-20: brief intro of new samples

Microsoft All-In-One Code Framework 20th December, 2009 updates. Download:

https://cfx.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=37537

If this is the first time you heard about All-In-One Code Framework(AIO) project, please refer to the relevant introduction on our homepage: https://cfx.codeplex.com/

In this release, we added more new samples on ADO.NET Entity Framework 4.0 in VS2010 Beta2.

Data Platform New Samples

CSEFModelFirst, VBEFModelFirst

These two samples demonstrate you that how to build DDL with Entity Framework 4.0’s new feature, thus build database according to the Entity Data Model. Meanwhile, you will see some Visual C# and VB.NET adding, query code and new built database testing.

CSEFComplexType, VBEFComplexType

These two samples demonstrate a new big function of Entity Framework 4.0 – Foreign Key Association. Comparing Foreign Key Association with Independent Association, and demonstrating how to add new relevant data, relevant data for existed data and updating relevant data give you a complete view of Foreign Key Association and contribute to better understanding.

ASP.NET New Sample

CSASPNETCustomDataSourceForRDLC

This sample demonstrates how to use user-defined class as data source to build a client report, and implement this client report with an ASP.NET application.

VBASPNETRadioButtonTreeView

The project shows how to simulate a RadioButton Group within the TreeView control to make the user can only select one item from a note tree. Since there is no build-in feature to achieve this, we use two images to imitate the RadioButton and set TreeNode's ImageUrl property as the path of these images. When user clicks the item in tree, reset the Checked value and the ImageUrl value of the treenode to make it looks lick a selected item of a RadioButton appearance.

CSASPNETImageMap

The project illustrates how to use ImageMap to create an introduction of the planets in Solar System via VB.NET language. When the planet in the image is clicked, the brief information of this planet will be displayed under the image and the iframe will navigate to the corresponding page in WikiPedia.

CSASPNETExcelImportExport

This CSASPNETExcelImportExport sample introduces how to import data from an Excel spreadsheet to SQL Server and how to generate an Excel spreadsheet with data from SQL Server.

This project includes two pages: Default and Image.

ExcelExport page retrieves data from SQL Server using a DataTable and then exports the DataTable to an Excel 2003/2007 spreadsheet on server disk.

ExcelImport page fills a DataTable with data from an Excel 2003/2007 spreadsheet using a DataTable, and then import the DataTable to SQL Server via SqlBulkCopy, which efficiently bulk loads a SQL Server table.

This sample uses the SQLServer2005DB sample database.

CSASPNETSendMail

The CSASPNETSendMail sample demonstrates how to send mail via System.Net.Mail in ASP.Net Ajax.

Silverlight New Samples

VBSL3WriteableBitmap

WriteableBitmap is a new feature in Silverlight 3. It allows you to work with raw pixel data of a bitmap image. This enables a lot of useful scenarios. However, due to the limitation in the security sandbox (for example, unable to write unsafe code that uses pointers), you may need to write more code compared to a similar desktop application.

This sample contains 3 sub samples which demonstrate some common tasks when working with WriteableBitmap:

· The gun shoot sample. It allows you to select two images of different size, scales them to the same resolution, and puts one on top of the other. When you click the top image to fire some bullets, a gun mark will be created, and you'll be able to see through the bottom image. This sample demonstrates how to scale a source image to a specific resolution (800 * 600 in this case), as well as how to modify individual pixels.

· The fill color sample. It implements a common feature in painting programmers: Fill an area with a solid color. It demonstrates how to apply common algorithms to Silverlight WriteableBitmap, as well as how to avoid stack overflow in very deep recursive methods by simulating the way CLR invokes methods.

· The screenshot sample. It demonstrates another feature of WriteableBitmap: Create bitmap screenshots from either bitmap or non-bitmap elements. It allows you to save the result to a bmp file. It also demonstrates the limitation of the screenshot feature.

CSSL3IsolatedStorage, VBSL3IsolatedStorage

This project create a Isolated Storage Explorer, with the use of explorer, user could view application iso's virtual file structure, and it also provides these file management functions:

· Create dictionary

· Upload local file to isolated storage

· Open media stream stored in isolated storage and play

· Delete dictionary/file

· Increase isolated storeage Quota

· Save isolated storage file to local

· Use IsolatedStorageSettings to store/load config

CSSL3DataBinding

This example demonstrates how to work with Data Binding Silverlight 3.

It includes the following general scenarios:

· How to use onetime/oneway/twoway Data Binding.

· What is IValueConverter and how to use it.

· How to handle data validation in Data Binding.

· How to use Element Data Binding to bind to the property of other controls.

· What is ObservableCollection.

· General problems you may encounter with when using Data Binding.

WPF New Samples

CSWPFAnimatedImage

The sample demonstrates how to display a series of photos just like a digital picuture frame with a "Wipe" effect.

CSWPFPaging

The sample demonstrates how to page data in WPF.

CSWPFTwoLevelGrouping

The sample demonstrates how to display two level grouped data in WPF.

Visual Studio Extensibility New Samples

CppVsGetServiceBackgroundThread

This sample demonstrates how to get a service in a background thread. Services cannot be obtained by means of IServiceProvider.QueryService from a background thread. If you use QueryService to get a service on the main thread, and then try to use the service on a background thread, it also will fail.

To get a service from a background thread, use CoMarshalInterThreadInterfaceInStream in the IVsPackage.SetSite method to marshal the service provider into a stream on the main thread. You then can unmarshal the service provider on a background thread and use it to get the service. You can unmarshal only once, so cache the interface that you get back.

CSVSAutomationOutsideIDE

This sample demonstrates how to automate Visual Studio outside the IDE. One can use existing Visual Studio instance or create a new one to execute specified command or automate by DTE object, like macro or add-in. In this sample, we first find an existing Visual Studio instance or create a new one and navigate its browser to All-In-One homepage.

CSVSToolbars

VSPackages are software modules that make up and extend the Visual Studio integrated development environment (IDE) by providing UI elements, services, projects, editors, and designers. VSPackages are the principal architectural unit of Visual Studio, and are the unit of deployment, licensing, and security also. Visual Studio itself is written mostly as a collection of VSPackages.

This sample demonstrate how to use the the Visual Studio Integration Package Wizard to create a simple VSPackage with a toolbar.

Windows Service New Samples

CppWindowsService, CSWindowsService, VBWindowsService

This sample demonstrates creating a simple Windows Service application that writes messages to the Application log when the service is started and stopped.

Office development New Samples

CSAutomateVisio, VBAutomateVisio

The CSAutomateVisio provides the examples on how to automate Office Visio 2007 via Visio Object Model.

XML New Samples

CSXslTransformXml, VBXslTransformXml

This sample project shows how to use XslCompiledTransform to transform an XML data file to .csv file using an XSLT style sheet.

Library New Samples

VBPInvokeDll

Platform Invocation Services (PInvoke) in .NET allows managed code to call unmanaged functions that are implemented and exported in unmanaged DLLs. This sample shows you what you need to do to be able to call the exported functions in the unmanaged DLLs like CppDllExport.dll, msvcrt.dll, from VB.NET.

VBLoadLibrary

VBLoadLibrary in VB.NET mimics the behavior of CppLoadLibrary to dynamically load a native DLL (LoadLibrary) get the address of a function in the export table (GetProcAddress, Marshal.GetDelegateForFunctionPointer), and call it. It serves as a supplement for the P/Invoke technique and is useful especially when the target DLL is not in the search path of P/Invoke.

If you have any suggestion and feedback about our All-In-One Code Framework, please feel free to let us know here. Thanks!