Friday, June 19, 2009

Orange bug: “Quadrant” & Expression Blend

Orange bug is not a bug :) I’ve tested icon customization in “Quadrant” and my icon has bug shape! How assign “Oslo” model with icon? It’s very simple.

First, you create XAML GeometryPath. For this purpose you can use Microsoft Expression Blend.

r4_blend 

Next, you define Viewer Hint with “M”. Compile it and deploy to “Quadrant” repository (details:  Help –> Quadrant Repository Connection).

r4_icon

Finally, you restart “Quadrant” and you see the icon with the type you set in Viewer Hint.

I have defined “Quadrant” extensions for Form instances in my last example: User interface modeling with simple DSL.  You can download  it here.

Wednesday, June 17, 2009

"MGrammar" XAML Samples & Ultra Flexible Event Pattern Mesh Sample – my versions compatible with May CTP

There’re many samples which work with the newest “Oslo” May CTP on the Oslo Developer Center, but not all.  I’ve successfully tried to make my versions of two samples ("MGrammar" XAML Samples, Ultra Flexible Event Pattern Mesh Sample) compatible with new SDK . 

Running MWindow application in the first example was the most difficult thing.

You should change version of Xaml assembly from 1.0.0.0 to 3.0.0.0 otherwise you get exception at runtime.

File/assembly Class Method Line Code
MWindow.cs MWindow CreateLabelMap 92

var clrTypeResolverType = Type.GetType("System.Xaml.ClrTypeResolver, Xaml, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");

MWindow.cs MWindow CreateLabelMap 96

var nsRecordType = Type.GetType("System.Xaml.ClrTypeResolver+XamlNamespaceRecord, Xaml, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");

Old MGraph API still works,  but MGraphXamlReader produced bad nodes, so  bad XAML and bad tree of objects were generated. I debugged application and compared results with the program running with previous Oslo SDK on second computer. I detected code with different behavior:

File/assembly Class Method Line Code
ContentEntry.cs  ContentEntry

button1_Click

72 xamlReader.ReadToEnd()  
MGraphXamlReader.cs  MGraphXamlReader GetReader 434 GetNodes(this.root, true)
MGraphXamlReader.cs MGraphXamlReader GetNodes 343 if (this.graphBuilder.IsEntity(node))
GraphBuilder.cs MWindowGraph
Builder
IsEntity 299 EntityStencil.IsEntityBase(this, value)
System.Dataflow.dll EntityStencil IsEntityBase    

Method IsEntityBase in class EntityStencil has different implementation and returns now false for MWindow application nodes:

  • “Oslo” January SDK :  System.Dataflow.dll (1.0.0.0)  ->  EntityStencil.IsEntityBase –> true
  •   “Oslo” May SDK :  System.Dataflow.dll (3.0.0.0)  ->  EntityStencil.IsEntityBase –> false

When I created own IsEntityBase  method with old implementation and called it instead of  EntityStencil.IsEntityBase, MXamlReader produced good nodes as with previous SDK.

You can download my versions of samples compatible with new SDK below.

"MGrammar" XAML Samples

Ultra Flexible Event Pattern Mesh Sample

Monday, June 15, 2009

User interface modeling with “Oslo” – my two samples with new CTP

This post will be about my two “Oslo” samples which I refreshed yesterday.

Sample One:  User interface modeling with simple DSL

I’ve defined model and DSL. Sample usage below.

r4_parse

I’ve written simple Silverlight runtime, too. It reads “Oslo” repository and generates user interface.

 r4_runtime

With “Quadrant” you can view and visually edit model instances.

r4_instance2

Sample Two:  User interface modeling with Visual Basic DSL

I’ve created more advanced GUI DSL with Visual Basic syntax and references. Language has custom compiler which creates .mx image.   I’ve used some patterns included in Spork sample.

r4_berlin_parse

You can download my “Oslo” samples here: