I will never understand the mind of a language designer.
Hello World Longhorn sample stolen from CodeProject:
// This is Avalon in Longhorn:
private void CreateWindow()
{
//create main window
MSAvalon.Windows.Window myWindow = new MSAvalon.Windows.Window();
myWindow.Width = new Length(300);
myWindow.Height = new Length(170);
//Add a canvas to the window
myCanvas = new MSAvalon.Windows.Controls.Canvas();
myCanvas.Background = MSAvalon.Windows.Media.Brushes.LightSteelBlue;
myCanvas.Width = new Length(100,UnitType.Percent);
myCanvas.Height = new Length(100,UnitType.Percent);
myWindow.Children.Add(myCanvas);
//Add a Text Box to the canvas
myTextBox = new MSAvalon.Windows.Controls.TextBox();
myTextBox.Width = new Length(200);
myTextBox.Height = new Length(40);
MSAvalon.Windows.Controls.Canvas.SetTop(myTextBox, new Length(30));
MSAvalon.Windows.Controls.Canvas.SetLeft(myTextBox, new Length(50));
myCanvas.Children.Add(myTextBox);
//Add a button to the canvas
myButton = new MSAvalon.Windows.Controls.Button();
MSAvalon.Windows.Controls.Canvas.SetTop(myButton, new Length(100));
MSAvalon.Windows.Controls.Canvas.SetLeft(myButton, new Length(110));
myButton.Content = "Click Me";
myCanvas.Children.Add(myButton);
//Add a event handler for Click Event
myButton.Click += new ClickEventHandler(OnClick);
//show the window
myWindow.Show();
}
Nice huh?
- - - - - - - - - - - - - - - - - - - - -
Now, look at this:
// This is XEN on steroids (well, my wish)
private UI myWindow : window
{
//create main window
Width = 300;
Height = 170;
//Add a canvas to the window
myCanvas = Canvas
{
Background = LightSteelBlue;
Width = 100%;
Height = 100%;
//Add a Text Box to the canvas
myTextBox = TextBox
{
Width = 200;
Height = 40;
Top = 30;
Left = 50;
}
//Add a button to the canvas
myButton = Button
{
Top = 100;
Left = 110;
Content = "Click Me";
//Add a event handler for Click Event
Click = OnClick;
}
}
}
And the winner is...
Remember guys, bring SQL and XML to the language, but don't forget about UI!
