CapableObjects forum



New builds of both ECO4 and ECO5 available

Posted By Jonas Hogstrom 2009-05-09 09:23:14
Add to Favorites0
Author Message
Jonas Hogstrom
 Posted 2009-05-09 09:23:14
Supreme Being

Supreme Being - (7 956 reputation)Supreme Being - (7 956 reputation)Supreme Being - (7 956 reputation)Supreme Being - (7 956 reputation)Supreme Being - (7 956 reputation)Supreme Being - (7 956 reputation)Supreme Being - (7 956 reputation)Supreme Being - (7 956 reputation)Supreme Being - (7 956 reputation)

Group: Administrators
Last Active: 2010-11-30 13:17:13
Posts: 1 230, Visits: 1 382
Today we have published a bigfix build for both ECO4 (changelog) and ECO5 (changelog).

Among the bugfixes in ECO5 there is also some interesting work in progress for a new feature called "ViewModels". You may have seen bits of it before (previously called "spans"), but now it can actually be used in runtime too.

The feature is about defining UI architecture independent view models that can later be rendered in your UI and hooked up to your domain objects.

Here are the steps to get a view model up and running:

* Rightclick your class designer and select "Extras->ViewModels..."
* define a new ViewModel and set the name to "Person_AutoForm" (assuming you have a Person class in your model)
* Set the class to Person
* Set the ColumnCount and RowCount to 5
* Rightclick the Green rectangle (DisplayClass) and add some columns from the Person class
* set the x-value for the new columns to 1
* Add a nested column or two using some of your relations from the PersonClass

You will be able to see a rendered version of your definition in the lower right corner of your form
* If you add a column and set the "IsAction" checkbox, it will be rendered as a button, and the expression will be interpreted as an EAL-Statement, so you can use this to trigger statemachines, call methods on the domain objects or set attribute-values for example.

Close the viewmodel form and save the ecomdl-file
locate the file called [GUID].spans in the Solution explorer and set the build-action for this file to EmbeddedResource (this will be automatic in the future)

IN your EcoSpace, add the following static constructor:

static MyEcoSpace()
{
Eco.ViewModel.Runtime.ViewDefinitionsInApplication.Init(MyEcoSpace.GetTypeSystemService().StaticEcoServices);
}


Now, start your application and open a standard ECO autoform for a Person object. Instead of the normal first tab with all attributes and singlelinks, your newly defined viewmodel will be rendered as a winform UI.

As I mentioned, this is all work in progress, and several of the above steps will be automated. We are currently working on a winform and a WPF rendering engine for the viewmodels, but an ASP rendering engine is planned too.

There are two user controls (one for winforms and one for WPF). THey are not registered in the toolbox yet, but you can add them manually to the toolbox(ViewModelUserControl in Eco.Windows.Forms.dll). If you drop the winform usercontrol on a form and set the EcoSpaceTypeName and the ViewModelName, you will see the components rendered in designtime.
To populate the usercontrol in runtime you do:

viewModelUserControl1.SetEcoSpace(ecoSpace);
viewModelUserControl1.ViewModel.SetElement(new Person(EcoSpace));

or use an existing instance of the personclass ofcourse.

Feel free to play around with it and give us feedback.


/Jonas Hogstrom [CapableObjects]
mtiede
 Posted 2009-05-28 17:41:15
Supreme Being

Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)

Group: Forum Members
Last Active: 2011-06-28 16:42:26
Posts: 487, Visits: 1 277
Okay, I have some feedback...

1. NestedDisplayClass left "orphaned"

I created the Green thingee. Then I added a couple of columns. Then I added a nesteddisplayclass. Then I deleted the column that was created for the nesteddisplayclass. The arrow linking the nesteddisplayclass disappeared, but the nesteddisplayclass was still on the diagram. Should it be? If it should, how would you hook it up again. Does it make sense that it is "orphaned"?

2. Selected viewmodel in listbox is not shown in the window.

After I created a viewmodel and closed the window and then reopened it, the just created viewmodel name is shown in the list box, but apparently it is not selected because the window only shows the diagram when I select the list box and then click on the viewmodel name.

3. Nesteddisplayclass allows another nesteddisplayclass?

I created a nestedisplayclass. Then I right clicked on it and created another nesteddisplayclass. Now there is an arrow connecting a blue box to a blue box. Both of nesteddisplayclasses show in the same spot on the "form" and there are no properties to move it around. I'm guessing you aren't supposed to have one nested connected to another... Or maybe the display is doing what you want, I don't know...

4. Row = Y, Column = X?

When you create the Green thingee, you specify how many rows and columns. Then when you position your columns, you have to specify X and Y. As I understand it, you should name X -> Column and Y -> Row. Many people would not know about X being horizontal and Y being vertical. Plus it just isn't consistent.

5. What is the "associated to"?

I'm not sure what that choice is supposed to be. And I would say "associated with" instead, but that may be an American English instead of English English. (Though even in American English I see people use one or the other indiscriminately.)

That's it for now...


/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
2009-05-28 18:49:12 by mtiede
mtiede
 Posted 2009-05-28 17:53:42
Supreme Being

Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)

Group: Forum Members
Last Active: 2011-06-28 16:42:26
Posts: 487, Visits: 1 277
When I change the Presentation to something with spaces, it looks like something isn't calculated right because the text expanded behind the input box.

/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
mtiede
 Posted 2009-05-28 18:01:05
Supreme Being

Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)

Group: Forum Members
Last Active: 2011-06-28 16:42:26
Posts: 487, Visits: 1 277
After creating the viewmodel, when I pressed the "generate code" button, I get an error window titled "Error updating project files" and a message "Object reference not set to an instance of an object". That is followed by a bunch of other error messages. One time, during the process of dismissing those messages, the VS IDE crashed.

/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
mtiede
 Posted 2009-05-28 18:01:58
Supreme Being

Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)

Group: Forum Members
Last Active: 2011-06-28 16:42:26
Posts: 487, Visits: 1 277
The Viewmodel window should remember its size if the user resizes it.

/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
mtiede
 Posted 2009-05-28 18:47:24
Supreme Being

Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)

Group: Forum Members
Last Active: 2011-06-28 16:42:26
Posts: 487, Visits: 1 277
In WPF at designtime, the user control was actually created as "viewModelWPFUserControl1" and not "viewModelUserControl1".

And I wasn't able to figure out what to do to make the connection at runtime. My viewModelWPFUserControl1 didn't allow me to do setEcoSpace or assign EcoSpace. It didn't recognize ecospace. I suppose I have to add something to the references, but I already had eco.wpf and I couldn't find anything else that looked like what I should use...

Any suggestions?



/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
2009-05-28 18:49:42 by mtiede
mtiede
 Posted 2009-05-28 21:19:52
Supreme Being

Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)

Group: Forum Members
Last Active: 2011-06-28 16:42:26
Posts: 487, Visits: 1 277
Here is what reflector says about that user control:

ViewModelWPFUserControl = public class(UserControl, IComponentConnector)

{ Fields }
private _contentLoaded: Boolean;
public ElementHandles: Dictionary;
assembly GridLayout: Grid;

{ Methods }
public constructor;
[DebuggerNonUserCode]
public method InitializeComponent;
[DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Never)]
private method System.Windows.Markup.IComponentConnector.Connect(connectionId: Int32; target: Object);
end;


No place to put EcoSpace that I see...


/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
mtiede
 Posted 2009-05-28 21:24:23
Supreme Being

Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)

Group: Forum Members
Last Active: 2011-06-28 16:42:26
Posts: 487, Visits: 1 277
Okay, here is what reflector says for the Winforms one:

ViewModelUserControl = public class(UserControl)

{ Fields }
private _designTimeInitiated: Boolean;
private _EcoSpace: EcoSpace;
private _EcoSpaceTypeName: String;
assembly _ViewModel: ViewModel;
private _ViewModelName: String;
public ElementHandles: Dictionary;
public TableLayoutPanel: TableLayoutPanel;

{ Methods }
public constructor;
private method CreateContent;
private method EnsureViewModel;
protected method OnPaint(e: PaintEventArgs); override;
public method SetEcoSpace(EcoSpace: EcoSpace);
private method UpdateDesignTimeView;

{ Properties }
[DefaultValue(''), TypeConverter('Eco.Handles.Design.EcoSpaceTypeNameTypeConverter, Eco.Handles.Design, Version=5.0.0.0, Culture=neutral, PublicKeyToken=46a833be9e90de8c')]
public property EcoSpaceTypeName: String read get_EcoSpaceTypeName write set_EcoSpaceTypeName;
[Browsable(false)]
public property ViewModel: ViewModel read get_ViewModel;
public property ViewModelName: String read get_ViewModelName write set_ViewModelName;
end;


I'm guessing the WPF one isn't really done yet...

CapableObjects? What is the status one this one? Should I wait for it or start coding my own ViewModel?


/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
mtiede
 Posted 2009-05-28 21:31:22
Supreme Being

Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)Supreme Being - (3 170 reputation)

Group: Forum Members
Last Active: 2011-06-28 16:42:26
Posts: 487, Visits: 1 277
I deleted the view model Green thingee which got rid of the autoform name from the combobox. Then I closed the window and try to recompile. Blew up VS.

/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
HansKarlsen
 Posted 2009-05-30 01:35:27
Supreme Being

Supreme Being - (3 009 reputation)Supreme Being - (3 009 reputation)Supreme Being - (3 009 reputation)Supreme Being - (3 009 reputation)Supreme Being - (3 009 reputation)Supreme Being - (3 009 reputation)Supreme Being - (3 009 reputation)Supreme Being - (3 009 reputation)Supreme Being - (3 009 reputation)

Group: Administrators
Last Active: Yesterday @ 18:25:39
Posts: 446, Visits: 2 654
Thanks for all your efforts;

In the next release we have a WPF viewmodel user control for you, nevertheless I do not discourage you from writing your own (I would wait until the next release with that too caused the intefaces has changed slightly) but writing your own, or override the ones we provide is part of the grand plan.


Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top