| By Bill Wolff | Article Rating: |
|
| September 3, 2005 09:00 AM EDT | Reads: |
25,188 |
XAML has a number of advantages. Control and attribute hierarchies are more apparent. Tools can easily be written to generate or interpret the markup. There is useful separation of UI and procedural code.
Simple XAML documents render in a browser much like an HTML Web page. As your application becomes more complex, events and procedural code must be added in a separate file. These are compiled together using the MSBuild utility.
This model is exactly the approach taken by Xamlon. You craft the interface elements in XAML and write managed code in C# or VB to handle logic and events. These are compiled into standard .NET MSIL (Microsoft Intermediate Language). The byte codes from the resulting DLL pass through a post compiler that maps .NET to Flash byte codes. The resulting SWF file can run in any browser or operating platform that has the Flash player.
The Xamlon Development Environment
There is decent support for Visual Studio 2003, including C# and VB.NET. Visual Studio 2005 will be supported at release time, including the inexpensive Express editions. Debugging relies on a Console.WriteLine technique; this is certainly not as smooth as standard .NET de-velopment. Hopefully a future version will fully integrate with the excellent Visual Studio debugging suite.
Notepad or a suitable text editor can be used with the .NET Framework SDK 1.1 if Visual Studio is not available. Xamlon uses the CSWF.exe command line compiler. This command line statement takes an XAML input file, two reference DLLs, and a C# source file to produce the expense.swf output file:
The .NET framework is not required on the client. All .NET language syntax is compiled to MSIL and then prost-processed through the Xamlon command line compiler to produce a standard Flash SWF file. In Visual Studio, this process is transparent to the developer. You can see the steps involved by opening the Output pane after compilation. The final step creates a sample HTML page that embeds the generated SWF. This is useful for testing and snipping an HTML code sample (see Listing 1).
cswf/xaml:expensereport.xaml /r:
SwfNative.dll,XamlControls.dll
/embed:XamlControls.dll /out:
expense.swf /verbose /clean /
launch /compress ExpenseReport.cs
Not all .NET classes are supported. Xamlon does comply with IL ECMA #335. There are basic Winform controls, databinding for controls, DataSet, and Web service support for connectivity to standard Web services like ASMX. GDI+ programmers will be pleased that basic graphic calls are converted to Flash. This feature can be used with or in place of XAML layout.
Flash player 6 or above is needed to run the SWF file. Xamlon calls this "Zero-Install Framework" (ZIF) since the .NET Framework is not required and the resulting file has an extremely small footprint. SWF files runs on most operating systems and browsers, giving unsurpassed market reach. Support for PocketPC is an added bonus since that platform already has a Flash player.
Supported Flash features include font embedding, ActionScript components or movies, SOAP support, video streaming, and MP3 embedding. Several useful tools are provided including a SWF to XAML converter. This takes existing Flash graphics and turns them into XAML layout. The Illustrator SVG to XAML converter does the same for Adobe Illustrator.
The included server component automatically proxies external Web service calls. This works on any available IIS/ASP.NET architecture.
AFLAX Simplifies AJAX
AJAX is the Asynchronous Javascript and XML design pattern. You can build dynamic, rich, Internet applications connected via XML Web services. There is a relatively complex programming model that is deployed through DHTML. The browser must understand XML processing for this to work. The programmer must write JavaScript code that parses XML and binds data nodes to HTML element tags. Popular examples are http://maps.google.com and www.start.com, a browser-based RSS reader created by Microsoft research.
Data is loaded as needed through background XML Web service calls. The page does not refresh or round trip to the server. The user experience is much cleaner than traditional server-based Web page logic.
AFLAX, Asynchronous Flash and XML, delivers a similar result using the simpler programming model offered by C# and VB.NET. The user interface relies on XAML for vector graphics and Xamlon compilation creates a Flash .SWF. This format is ubiquitous and works in most any browser variant.
Xamlon provides a server-side proxy that works as a Web service connection point. Standard C# and VB.NET Web service calls use SOAP to transfer data from the proxy to the running Flash instance. There is basic support for datasets and control databinding. This greatly reduces the amount of code needed for dynamic data-driven applications.
The Xamlon Web site features two excellent AFLAX examples. One is an enterprise application with real-time stock updates pulled directly from Yahoo Finance and Fidelity. The other is a clone of Google Maps.
Building a Simple App - XAML
You can build a Xamlon interface using the XAML declarative model or procedural code. Start by opening a new project. Xamlon installation adds template folders to both VB and C# (see Figure 1).
Published September 3, 2005 Reads 25,188
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Bill Wolff
Bill Wolff is an independent consultant, trainer, and architect specializing in Microsoft development technologies. His company, Agility Systems, is based in the Philadelphia area. He ran the consulting firm Wolff Data Systems for 15 years and directed armies of consultants in the dot com world. Bill is founder and President of the philly.net user group, board member for INETA (Vice President, Speaker Bureau), and he is active in several other user communities. Bill was a contributing author to several books and articles and he currently writes for .NET Developer's Journal. His certifications include trainer, systems engineer, developer, and Microsoft MVP for VB.NET.
- Kindle 2 vs Nook
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Infrastructure-as-a-Service Will Mature in 2010: Microsoft's David Chou
- Windows 7 – Microsoft’s First Step to the Cloud
- Cloud Expo and the End of Tech Recession
- Jill Tummler Singer, Deputy CIO of CIA, Keynotes at GovIT Expo
- Reality Check at the Cloud Computing Expo
- Visual Studio 2010 Is Cloud Friendly
- Fired SCO CEO Fires Back
- Kindle 2 vs Nook
- The Difference Between Web Hosting and Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- Wave on Ulitzer: Confessions of a Google Wave Fanboy
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Cloud Computing Best Practices
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Infrastructure-as-a-Service Will Mature in 2010: Microsoft's David Chou
- Eval JavaScript in a Global Context
- Windows 7 – Microsoft’s First Step to the Cloud
- Google Maps and ASP.NET
- Crystal Reports XI & How It Has Changed
- Converting VB6 to VB.NET, Part I
- Creating Controls for.NET Compact Framework in Visual Studio 2005
- Where Are RIA Technologies Headed in 2008?
- How to Write High-Performance C# Code
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Implementing Tab Navigation with ASP.NET 2.0
- i-Technology Photo Exclusive: Bill Gates & Steve Jobs In "Nerds"
- .NET Archives: Getting Reacquainted with the Father of C#
- i-Technology Viewpoint: "SOA Sucks"
- Programmatically Posting Data to ASP .NET Web Applications




























