A new release of Microsoft All-In-One Code Framework is available on March 8th.
Download address: http://1code.codeplex.com/releases/view/62267#DownloadId=215627
You can download individual code samples or browse code samples grouped by technology in the updated code sample index.
If it’s the first time that you hear about Microsoft All-In-One Code Framework, please read this Microsoft News Center article http://www.microsoft.com/presspass/features/2011/jan11/01-13codeframework.mspx, or watch the introduction video on YouTube http://www.youtube.com/watch?v=cO5Li3APU58, or read the introduction on our homepage http://1code.codeplex.com/.
The code sample was created by Amit Dey. It demonstrates a custom TreeView with added functionalities of CRUD (Create, Read, Update, Delete) and drag-and-drop operations. Silverlight TreeView control with CRUD and drag & drop is a frequently asked programming question in Silverlight forums. Many customers also requested this code sample in our code sample request service. We hope that this sample can reduce developers' efforts in handling this typical programming scenario. The following blog article introduces the sample in detail: http://blogs.msdn.com/b/codefx/archive/2011/02/15/silverlight-treeview-control-with-crud-and-drag-amp-drop.aspx.
CSSL4FileDragDrop and VBSL4FileDragDropDownload: http://1code.codeplex.com/releases/view/62253#DownloadId=215809http://1code.codeplex.com/releases/view/62253#DownloadId=215810
The code sample demonstrates the new drag&drop feature of Silverlight 4 to implement dragging picures from the local file system to a Silverlight application.
New ASP.NET code samples
Sometimes we want to change SiteMapPath control's titles and paths according to Query String values. And sometimes we want to create the SiteMapPath dynamically. This code sample shows how to achieve these goals by handling SiteMap.SiteMapResolve event.
CSASPNETEncryptAndDecryptConfiguration, VBASPNETEncryptAndDecryptConfigurationDownload: http://1code.codeplex.com/releases/view/62253#DownloadId=215027http://1code.codeplex.com/releases/view/62253#DownloadId=215106
In this sample, we encrypt and decrypt some sensitive information in the config file of a web application by using the RSA asymmetric encryption. This project contains two snippets. The first one demonstrates how to use RSACryptoServiceProvider to generate public key and the corresponding private key and then encrypt/decrypt string value on page.
The second part shows how to use RSA configuration provider to encrypt and decrypt configuration section in web.config of web application.
connectionStrings section in plain text:
Note that if you store sensitive data in any of the following configuration sections, we cannot encrypt it by using a protected configuration provider
I believe ASP.NET programmers will like this sample, because in many cases we need customers know the current status of the uploading files, including the upload speed and completion percentage and so on. Under normal circumstances, we need to use COM components to accomplish this function, such as Flash, Silverlight, etc. The uploading data can be retrieved in two places, the client-side and the server-side.
For the server side, we can get the information through coding, but the key question is how to tell the client results. In this case, We will combine custom HTTPModule and AJAX technology to illustrate how to analyze the HTTP protocol, how to break the file request packets, how to customize the location of the server-side file caching, how to return the file uploading status back to the client and so on .
CSASPNETHighlightCodeInPage, VBASPNETHighlightCodeInPageDownload: http://1code.codeplex.com/releases/view/62253#DownloadId=215029http://1code.codeplex.com/releases/view/62253#DownloadId=215108
This sample imitates a system that needs display the highlighted code in an ASP.NET page . As a matter of fact, sometimes we input code like C# or HTML in a web page and we need these codes to be highlighted for a better reading experience. It is convenient for us to keep the code in mind if it is highlighted. So in this case, the sample shows how to highlight the code in an ASP.NET page.
It is not difficult to highlight the code in a web page by using String.Replace method directly. This method can return a new string in which all occurrences of a specified string in the current instance are replaced with another specified string. However, it may not be a good idea, because it's not extremely fast, in fact, it's pretty slow. In addition, it is hard to highlight multiple keywords by using String.Replace method directly. Sometimes we need to copy source code from visual studio to a web page, for readability purpose, highlight the code is important while set the different types of keywords to different colors in a web page by using String.Replace method directly is not available.
To handle this issue, we need to use a hashtable variable to store the different languages of code and their related regular expressions with matching options. Furthermore, define the css styles which used to highlight the code in a web page. The sample project can auto add the style object to the matching string of code.
A step-by-step guide illustrating how to highlight the code in an ASP.NET page:
1. the HighlightCodePage.aspx page
Choose a type of language in the dropdownlist control and paste the code in the textbox control, then click the HighLight button.
2. Display the highlighted code in an ASP.NET page
After user clicks the HighLight button, the highlighted code will be displayed at right side of the page.
This article describes an All-In-One framework sample that demonstrates a step-by-step guide illustrating how to build a virtual keyboard in your HTML page.
Sometimes we may need to offer a virtual keyboard to let users input something without their real keyboards. This scenario often occurs when users will enter their password to get access to our sites and we want to protect the password from some kinds of back-door software, a Key-logger for example, and we will find a virtual keyboard on the page will be a good choice here.
However, if we indeed want a virtual keyboard to substitute for the real keyboard completely, we will need more advanced logic to handle keys like Caps-Lock and Shift etc. That will be a complex work to achieve.
This code sample demonstrates how to create an Image Gallery application by using the DataList control in ASP.NET.
You may find the Image Gallery is widely used in many social networking sites, personal websites and E-Business websites. For example, you may use the Image Gallery to show a library of personal uploaded images on a personal website. Slideshow is also a popular tool to display images on websites. This code sample demonstrates how to use the DataList and ImageButton controls in ASP.NET to create an Image Gallery with image navigation. You can click on a thumbnail image in the Datalist control to display a larger version of the image on the page. This sample code reads the image paths from a certain directory into a FileInfo array. Then, the FileInfo array is used to populate a custom DataTable object which is bound to the Datalist control. This code sample also implements a custom paging system that allows five images to be displayed horizontally on one page. The following link buttons are used to implement a custom paging system: • First • Previous • Next • Last
Note We recommend that you use this method to load no more than five images at a time.
You can also set the SelectedIndex property for the DataList control to limit the number of the thumbnail images that can be selected. To indicate which image is selected, you can set the SelectedStyle property for the DataList control.
The sample demonstrates how to check an executable file type. For a given executable file, we can get
1 whether it is a console application2 whether it is a .Net application 3 whether it is a 32bit native application. 4 The full display name of a .NET application, e.g. System, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
The sample demonstrates how to create and deploy an IE Explorer Bar which could list all the images in a web page.
The sample demonstrates how to create and deploy a Browser Helper Object, and the BHO in this sample is used to disable the context menu in IE.
Consider that there are two such workflow instances: start start | |Receive activity Receive activity | |Receive2 activity Receive2 activity | |
A WCF request comes to call the second Receive2 activity. Which one should take care of the request? The answer is Correlation. This sample will show you how to correlate two workflow service to work together.
Failed to display image slideshow in a Windows Forms application - where to find more details on how to implement this?