Tech Ed Live Blog - Avalon and Win Forms with Tony Goodhew
Live Blogging WIndows Forms and Avalon with Tony Goodhew
Avalon not necessarily a replacement of WInforms. Will be able to start to easily integrte the two.
Quick slide on Avalon Framework
.NET and DirectX based.
Unifying Documents, Graphics and Metadata. Tony says that it is borrowing ideas from the web world and applying to richer desktop UI. Avalon aimed at bringing cmpelling UI to the client.
e.g. Data Viz- more graphicly rich display model. Can increase the rentention in knowledge of users.
Will be shipping as part of Windows Vista. Will be on the machine but will not be dehydrated until 1st run. JIT deploy will be seemless. First startup there will be some overhead but after that WinFX just available.
Redist package available for WinXP and Win Server 2003. Will need to bundle the redist with apps for those platforms.
Tony left his demo cheat sheet in his bag *grins*..... I've done that before.....
Demo is MediaMania demo. Running in XP not Vista. So miss some of the Glass UI stuff.
Key things that help us now:
A key problem with windows apps is they are built around a bitmap drawing system. Avalon changes this. Renders correctly even if we scale right up. Developer doesn't need to right scaling code.
Calls out to Amazon Web Service. Returns list of music albums. Tony starts talking about XAML and how we have split UI defnintion in Avalon.
e.g. We have a standard Avalon list box and we have written some XAML to skin it with new look including images. Tony now talking about scaling- the application is good at taking advantage of more screen real estate. VEry clever though- not just scaling. E.g. Text label control. One column when narrow. As you make it wider at run time by making wind bigger it will add more clumns and flow text correctly.
Lots of great new UI features all done in Markup language. Tony showing how we can 'reskin' the list box. \Can achieve MAJOR change.
Went from standard list to a 3D array of tiles.
Now back to slides and talking interop.
We can use Avalon to enhance existing winforms app. Might already have a set of controls that encapsulate business logic- might want to just add avalon look over the top. Avalon has a much more detailed eventing model for change notification. Still easy to take data code from 1.1/2.0 and take it into Avalon.
New control called ElementHost that allows hosting Avalon control within a winforms app. Deals with some of the background properties and that sort of host related stuff. GOing the other way you can drop a WIndowsFormsHost component into Avalon to host a windows control- strictly can host anything that has an HWnd.
Forms and WIndows just work together.
Some tehcnlogies don't transfer across... e.g. TRansparency, some styling stuff. If the WinForms control doesn't support what you want, you can't just get it by hosting inside Avalon. Some limitations are around ZOrder- HWnd host has to be at the top of the Z-Order.
THey are looking at ways to allow stuff to be rendered out to Metro- this will be preoblematic around WinForms controls... still working on the problem.
Showing a stock ticker that pulls details from NYSE.
Shows list being populated and chart being brought up. Going to show WInforms Charting Control being hosted. We've opened up the XAML. At the moment we see XML. Assured that we will get some graphical tools soon. At the moment it is a case of editing raw XML with Schema support. Unsure right now as to whether this will be available in 2005 or whether we will have to wait until Orcas (VS.2005.Next).
So we are now loking at how to embed WIndows Forms chart control. NOt much code to write. Can't really see it though- this room (Elliot in the crown) is too long for the size of the screen.
Good demo. Just works. Looks good and not out of place having WInforms control in there.
Back to PPT.
So when do we want to use what?
Not telling us to reqrite existing application in WinFX. But, are there areas of the app whch we could take advantage of WinFX in.
Can we use both?
Can we build apps that take advantage of WInFX when we find it.
We need to seperate the UI and the business logic. Make sure that you sperate the UI from the business logic. Abstract it out correctly. use events appropriately- observer patters, MVCs etc...
If you have a dependency then take it on the basis of broadest platform appeal. e.g. If you need a bitmap use a Windows Forms Bitmap not an Avalong bitmap so things can still be used on nw non WInFX platform.
So we are now looking at putting an Avalon Listbox into a WinForms app. We have the form in design view. Drops in the Element host, some databinding support controls to allow binding the Avalong control to windows forms dataset. Not able to drag and drop the Avalon control yet :-( BOooo... I was getting excited for a minute there!
Actually write some code to add it during a runtime formload handler.
Demo worked well... TOny happy......
Now we're goi9ng to look at how to make it adaptive- i.e. so it still works on Windows 2000... i.e. non WInFX platforms. So what did we do to determine it was running on WInFX? At present can check in code by trying to find the actuall class using reflection. Thus doen't require a dependancy... late bound not early bound.
If it doesn't exist we can just use our normal code and display a non Avalon Control.
Really need to do something about the screen in this room. A bit hopeless..... can't see squat. TOo much looking at code that I can't see in this demo now. BUt we get the idea. Runtime detection of WInFX support and draw either Avalon or WinForms depending on our actual machine. Has used two seperate cotrol projects thus allowing us to avoid any early bound (depency) references
in our actual Winforms project. DOn't need an Avalon dependency until we actually dyaniclally load the Avaol styled listbox cntrol at runtime. We do similar stuff to this in order to make our applications run on the same code base on WIndows Mobile and on WinForms desktop.
Back into PPT.
The obligatory Call to Action Slide
Key message here is to seperate the Business and UI logic. Says to use PAG P&P guidance.
Need to look at two to three year plan and plan how we will get there with introduction of WInFX.
We will need to look at some of this as check that we can migrate our metedata driven WInforms and CF Forms engine to Avalon at some point.
.NET|Sunday, August 28, 2005 11:57:59 PM UTC||