New release of Microsoft All-In-One Code Framework is available for download - March 2011 - Microsoft All-In-One Code Framework - Site Home - MSDN Blogs
Microsoft All-In-One Code Framework - Developers' Pain Killer

New release of Microsoft All-In-One Code Framework is available for download - March 2011

Rate This
  • Comments 1

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/.

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

New Silverlight code samples

CSSLTreeViewCRUDDragDrop
Download:
http://1code.codeplex.com/releases/view/62253#DownloadId=215808

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 VBSL4FileDragDrop
Download:
http://1code.codeplex.com/releases/view/62253#DownloadId=215809
http://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

CSASPNETBreadcrumbWithQueryString
Download:
http://1code.codeplex.com/releases/view/62253#DownloadId=215022

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, VBASPNETEncryptAndDecryptConfiguration
Download:
http://1code.codeplex.com/releases/view/62253#DownloadId=215027
http://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:

Encrypted connectionString:

 Note that if you store sensitive data in any of the following configuration sections, we cannot encrypt it by using a protected configuration provider

<processModel>
<runtime>
<mscorlib>
<startup>
<system.runtime.remoting>
<configProtectedData>
<satelliteassemblies>
<cryptographySettings>
<cryptoNameMapping>

CSASPNETFileUploadStatus
Download:
http://1code.codeplex.com/releases/view/62253#DownloadId=215028

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 client, for the safety factors, the file upload status information cannot be got from JavaScript or server-side code, so we need COM component, like Flash and Silverlight to accomplish this, I do not like this approach because the customer need to install these components, but also we need to learn another programming framework.

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, VBASPNETHighlightCodeInPage
Download:
http://1code.codeplex.com/releases/view/62253#DownloadId=215029
http://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.       

CSASPNETPreventMultipleWindows
Download:
http://1code.codeplex.com/releases/view/62253#DownloadId=215032

This sample demonstrates a step-by-step guide illustrating how to detect and prevent multiple windows or tab usage in Web Applications. The sample imitates a system that need to prevent multiple windows or tabs to solve some problems like sharing sessions, protect duplicated login, data concurrency, etc. In fact, there are many methods achieving this goal. Here we give a solution of use JavaScript, Sample shows how to use window.name property check the correct links and throw other requests to invalid pages. This code-sample use two user controls to make a distinction between base page and target page, user only need drag different controls to appropriate web form pages. so user need not write repetitive code in every page, it will make coding work lightly and convenient for modify your code. 

JSVirtualKeyboard
Download: http://1code.codeplex.com/releases/view/62253#DownloadId=215093

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.

To create a virtual keyboard, we firstly need to add some buttons to the page. And when users click on a certain button, the JavaScript function handling the onclick event will input an appropriated character to the textbox. That is the simple logic of this feature.

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.

CSASPNETDataListImageGallery
Download: http://1code.codeplex.com/releases/view/62261#DownloadId=215267

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.

VBASPNETSearchEngine
Download: http://1code.codeplex.com/releases/view/62253#DownloadId=215112

This sample shows how to implement a simple search engine in an ASP.NET web site. It uses LIKE condition in SQL statement to search database. Then it highlights keywords in search result by using Regular Expression and JavaScript.

New Windows General code samples

CSCheckEXEType, VBCheckEXEType
Downloads:
http://1code.codeplex.com/releases/view/62253#DownloadId=215045
http://1code.codeplex.com/releases/view/62253#DownloadId=215120

The sample demonstrates how to check an executable file type.  For a given executable file, we can get

1 whether it is a console application
2 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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL

New Internet Explorer code samples

CSIEExplorerBar, VBIEExplorerBar
Downloads:
http://1code.codeplex.com/releases/view/62253#DownloadId=215060
http://1code.codeplex.com/releases/view/62253#DownloadId=215133

The sample demonstrates how to create and deploy an IE Explorer Bar which could list all the images in a web page.

CSBrowserHelperObject, VBBrowserHelperObject
Downloads:
http://1code.codeplex.com/releases/view/62253#DownloadId=215044
http://1code.codeplex.com/releases/view/62253#DownloadId=215119

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.

New Windows Workflow Foundation code samples

CSWF4ActivitiesCorrelation
Download: http://1code.codeplex.com/releases/view/62253#DownloadId=215085

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.


Leave a Comment
  • Please add 5 and 7 and type the answer here:
  • Post
  • Failed to display image slideshow in a Windows Forms application - where to find more details on how to implement this?

Page 1 of 1 (1 items)