|
|||||||
![]() |
|
|
Thread Tools |
|
#1
|
|||
|
|||
|
I really love Ext but coding in javascript just gives me the chills. So I went out and found a way to use my favorite js library (Ext) and my favorite programming language (C#) at the same time. By using a project called Script# I am able to write C# code and have it converted into javascript, similar to GWT. Building on that, Script# also allows you to code against external APIs, but you need to create the types, methods, properties, etc. for everything in the javascript library. So what I did was write a little console app that parses all of the ExtJS source files extracting out the script comments and writing C# files for each class. The end result is a programmable C# API to access all of the Ext objects and I threw in a couple new things to make life a little easier.
Since the entire API is generated, I haven't been able to check every piece of code to make sure nothing is missing, but from what I can tell all of it should be there. The only thing that doesn't work and I have to spend some time to figure out is the methods on Function objects such as createDelegate, defer, etc. Script# includes a createDelegate method but not a defer method. Another feature I want to get done is to create types for each classes constructor config objects so you can get intellisense on the config parameter. Here is a demo page I put online, this was written entirely in c# code. It's just the Products in the Northwind DB (Note: This app still uses Ext 1.1.1, I'll update it one day) http://ext.ordereze.net/scriptsharp/products.aspx Here's a link to download the complete demo project http://extsharp.googlecode.com - The only requirement to run this project locally is to download and install Script# from here and VS2005 of course And here's the source code for the javascript parser that creates the Ext API http://extsharp.googlecode.com UPDATE - 9/14/07 A few things to be aware of when working with this api
UPDATE - 9/16/07 I've put all source code and downloads on the GoogleCode project website http://extsharp.googlecode.com I'll be making updates to the svn repository over there The change log can be viewed there as well http://extsharp.googlecode.com/svn/trunk/CHANGELOG.txt UPDATE - 10/3/07 This API has been converted to work with the ExtJS 2.0 alpha release. I want to create some samples using it before packaging it up for a release though. Expect an update within the next few days. UPDATE - 12/5/07 Updated ExtSharp to parse ExtJS v2.0 Final. Zipped up the parser and the samples. Intellisense ![]() Method Signatures with param info ![]() Method Overloads for varying params ![]() Method Overloads for unlimited param functions I currently have max 15 overloads, but more can be created by just changing a number in the converter project ![]() Compile-time error checking ![]() Events list with usage info ![]() Delegates for all events ![]() Intellisense for config options ![]() |
|
#2
|
||||
|
||||
|
Awesome - please keep up posted on your progress!
|
|
#3
|
|||
|
|||
|
Really great initiative!! If you need any help, just let us know! and keep us posted on updates....
Thanks Marco |
|
#4
|
||||
|
||||
|
Script# seems to be for C# developer only. Anything for VB guys?
|
|
#5
|
|||
|
|||
|
Yeah Script# is only C#, there isn't anything for VB as far as I know.
|
|
#6
|
||||
|
||||
|
Looks really promising, looking forward to your progress
|
|
#7
|
|||
|
|||
|
I started to play with this and got it compiled... It seems you're using a older version of script# (0.4.2 is latest version), but after changing the references all works fine..
It seems that the SP "GetProductsPagedAndSorted" is missing in the database.. (it seems that resharper doesn't handle the checkbox "do not reference mscorlib.dll" ... Thanks Marco |
|
#8
|
|||
|
|||
|
1. I upgraded to Script# v0.4.2 and fixed the references in the zip file above
2. I verified that the sproc "GetProductsPagedAndSorted" is in the db. Here it is if you don't want to download the whole thing again:
Thanks so much for your comments. I'm glad I'm not the only person who has an interest in this. |
|
#9
|
||||
|
||||
|
I remember seeing Script# about a month ago and thinking it was pretty fantastic. But the very next day, I saw a blog about Microsoft's DLR (Dynamic Language Runtime). Which promises to make techniques like Script# a thing of the past.
But honestly Teflon, I'm very happy you took the initiative, and I'm going to give your code a try. I find JavaScript just as easy to write as C# or VB.Net, but having a compiler check for typos and type safety makes my job that much easier. Again, thanks a ton! |
|
#10
|
||||
|
||||
|
Nice job.. I thought about doing this, but its a lot of C# code to write
Well done.
__________________
ExtJsExtender Controls http://www.extendersamples.qsh.eu My Blog http://rodiniz.blogspot.com |
![]() |
| Thread Tools | |
|
|