Ajax| Program | create
Brief Introduction
ASP.net atlas is a rich class library for ASP.net development of AJAX-style applications. This article attempts to explain the general features of the Atlas framework, and since Atlas is a large library, this article focuses on the two most important features of Atlas:
1. Ability to invoke server-side Web services from client script
2. Making it easy to develop CROSS-BROWSER-compliant JavaScript code
Through the introduction of these two features, readers can be familiar with the Atlas class library using methods.
background
MFC scribble application is one of the famous examples of learning MFC programming. The Scribble application allows the user to use the mouse to paint freely. I have seen such a similar application using AJAX technology on the web. Unfortunately, this JavaScript drawing site can only be run on the Firefox browser. So I'll explain how to build a cross-browser version of the Scribble program in this article.
Installing Atlas
At the end of this article, you can click this link to download the December CTP for Atlas. If the link doesn't work, you can always go to the Atlas site and get the right link. The Atlas library can be used as a template (VSI) for Visual Studio 2005. There is a description of how to install this template at the download site just now.
Create an Atlas project
Once the Atlas template is installed, you can create a blank Atlas project by clicking the menu option "File->new->web Site". You can then open the New Web Site dialog box, shown in Figure 1.
Under "Location", you can select either "File System" or "HTTP". Choosing HTTP will allow you to base your site on an IIS server, and choosing File system will allow you to create a site on the local filesystem (you can use the development Web server for debugging and testing). You can choose either option, but I find that the application works better if you use Internet Explorer and run on IIS.
Atlas Air Engineering
The latest Atlas site created above has the following directory structure:
· App_Data
This is the empty directory where the data file is placed.
· Bin
This directory places the DLL file corresponding to the assembly set Microsoft.Web.Atlas. This directory contains the server location for the Atlas Library.
· ScriptLibrary
In this directory, you can place any JavaScript files for the application.
o Atlas
The Atlas client script is placed here, which has the following two subdirectories:
§debug
The debug version of the Atlas client JavaScript file is placed in this directory.
§release
The Atlas client JavaScript file release version is placed in this directory. The scripts in this directory are more compact and have some debugging code removed.
Atlas Client Script
The December release of Atlas provides the following client-side scripts:
· Atlas.js
This is the core Atlas script file, which includes basic tool functions and client controls and components.
· Atlascompat.js
This file contains the Atlas compatibility layer to support Mozilla Firefox and Apple's Imac-safari Web browser. This script will ensure that the Atlas code is cross-browser compatible.
· Atlascompat2.js
This file contains other functions to ensure compatibility with Safari web browsers.
· Atlasruntime.js
This is a miniature version of the core Atlas script file, which does not contain client components and controls. This script file is used when the previously mentioned component or control is not in use.
· Atlasuidragdrop.js
Contains tool functions that provide mouse drag-and-drop functionality in Web pages.
· Atlasuiglitz.js
Contains tool functions that provide animations and other special effects in Web pages.
· Atlasuimap.js
Script files that support the Atlas mapping framework using Virtual Earth.
Other documents
Atlas also adds the following files to the root directory of the Web site.
· Default.aspx and Default.aspx.cs
This page contains the Atlas Script manager Control-responsible for generating script blocks that reference the Atlas client script. A client script with a test/xml-script block type is also added to the page. This script block is used to write scripts using declarative XML syntax.
· EULA.rtf
· Readme.txt
· Web.config
This web.config is required to run the Atlas application. It contains some Atlas-specific configuration settings, and you can add the Atlas HTTP module and the HTTP processor to this file.
scribble Applications
The Scribble application allows the user to drag the left mouse button to draw the pattern freely. Ends a stroke when the user releases the mouse button or moves outside the painting area. You can use JavaScript and use VML technology to make a painting, but we're not going to use VML in this article.
An image (a regular HTML image with an IMG tag) appears on the default page of scribble. User mouse events on the image can be captured by JavaScript event handlers. The JavaScript function is able to send a point series corresponding to the drawing strokes to a Web service. The Web service updates the image objects saved in the session variable by drawing all the points sent by the user to the line. Finally, the client requests an updated image to the server. The image source is an HTTP processor that flows the image object stored in the session variable to the client. The following are the main components of the application.
· Default.aspx
The page that owns the dynamic image and the Atlas Script manager control.
· Scribbleimage.ashx
This is an HTTP processor that converts an image object stored in a session variable into streaming data.
· Scribbleservice.asmx
All painting requests are sent to this Web service. This Web service implements image modification.
· Scribble.js
The corresponding main JavaScript code for the application resides in this file to achieve a clear separation of design and code.
· Global.asax
The Session_Start and Session_End events are handled in Global.asax. Session_Start is used to create session variables, and session_end is used to free images stored in session variables.
[1] [2] [3] Next page