Creating First LiveUI application.
To start developing LiveUI based applicartion extract LiveUI.zip archive and
run Visual Studio Templates/install.bat
This installer will copy LiveUI project template to your Visual Studio project
templates directory. For example at C:\Users\ilyin\Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual
C#\. By the way, installer can fail if this directory does not exist.
Now let's run Visual Studio and create new LiveUI application.
And we get project like this
Set ExtFormsPage.aspx as startup page and run application.
So first application works itself; we do not have to implement something, but we
have to understand what's going on to implement something ourselves. Let's take
a look at ExtFormsPage.cs
public
partial
class
ExtFormsPage :
Page
{
protected
override
void OnInit(EventArgs
e)
{
var
rootComponent = new
ExtFormsRootComponent
{ Page = this, Workspace
= Page.Form };
var form =
new
Form();
var
message = new
TextField { Label
= "Message" };
form.Fields.Add(message);
var buttons =
new
OkCancelButtonSet();
form.Footer = buttons;
buttons.OkClick +=
delegate { message.Value
= "Hello world";
};
rootComponent.Children.Add(form);
rootComponent.Initialize();
}
}
This code creates application model for our form; i.e. It builds component tree
looking like this
When
root component initializes
rootComponent.Initialize();
LiveUI finds View for each component.
Views are responisble for building controls and
Html/JavaScript rendering. Key moment there is that components know nothing
about presentation and even different Views can be created for the same
application model.
One might ask is there are several Views for the same Component how LiveUI makes
decision which one to instantiate? Answer is It looks at Root component. For
example, if Root component is ExtRoot then only Ext based Views will be created
(see
contracts for details).
|