A WPF - IronRuby Scripting Console User Control
One of the clear value added possibilities with IronRuby and IronPython (or any DLR language) has to offer is making applications scriptable. This opens the possibility for enabling scripting of your application, it’s types and potentially objects running in memory in your application at runtime. I recently went looking for an IronRuby console / shell window control written natively in WPF and turned up nothing. I did however come across some examples implemented for Windows Forms and the one that got my attention was Orion Edwards Embedded IronRuby Interactive Console.
Whilst Orion’s project provided the basis of what I was after, I was under no illusion that I would find exactly what I was after and would therefore have to build out the rest of the functionality I required.
The Basic Requirements List
- Reusable WPF User Control
- The Console should allow users to write script against in memory objects of the host application.
- Should persist (to a log) the state of variables in the IronRuby runtime scopes.
- Extensible Application Design and easily maintained and Testable.
So rather than re-invent the wheel I started out with Orion’s code and worked it into a WPF User Control that followed the MVP pattern. This version supports printing of all scope variable state to the console window, clearing of the console window text and all the out of the box access to the IronRuby runtime from the console itself. The IronRuby Console User control also allows the consumer application to pass through in memory variables from your managed CLR hosting application.
Finally I need to also make mention that some of the classes used to stream the STD/IO came directly from Ben Halls wonderful IronEditor. And before I forget, the code can found here on my blogs subversion repository.
3 commentsScanning for information – WPF Databinding examples need to improve?
Personally I have a pretty rapid fire kind of scanning action that allows me to try to find information that matches my requirement quickly. Sometimes I need to slow down when the topic is too deep, for example Databinding in WPF. The examples out on the web for Databinding WPF are not that great yet (IMO) and too many only touch the simplest kind of Databinding scenarios, focussing largely on how the data is structured and from a Models point of view (no pun intended). Models can get pretty deep and nested, yet for the most part the binding examples focus on the really trivial data scenarios where the depth is not considerable and furthermore often binding to static resources rather than data that came from the Database courtesy of an ORM or perhaps Astoria or even plain old ADO.NET. So enough complaining cause that wont change anything and like Roy said ‘what are you going to do about it’ ; time to get on with putting some examples together myself! Of course they will end up here when they are done.
1 commentSilverlight mainly being taken up for Video Apps….I cannot concur.
On several occasions just recently, I have heard the idea being promoted that Silverlight is being taken up largely for it’s video application and that is where it’s purpose lies. I really can’t understand why this miscomprehension (IMO) still exists. Certainly the Obama Inauguration and the Olympics were quoted as references (again) but they are surely exceptions and in no way reflective of what’s happening in the small to medium enterprise.
My experience of late is suggests to me that SME .Net shops, where existing skills can be leveraged to build line of business smart‘ish client applications in the browser, is becoming an appealing possibility and is in fact indicative of my own personal story of late. I have long been living in the world of developing for the desktop and so the inevitable move into WPF is just that bit more compelling when you bundle Silverlight into the bargain. But I must say that I hope to hear less of the idea that Silverlight is simply for Video applications. Just check out the Silverlight forums and blogs that are proliferating. I think it’s becoming clear that there is significant momentum behind Silverlight and for it’s place in the line of business application and if you don’t look around in the SME space then you might not really know.









