Author |
Share Topic Topic Search Topic Options
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Topic: [SOLVED] Inter-module / Inter-view Communication Posted: 11-Oct-2007 at 9:59am |
This is working. I will utilize the EventBroker in many places...nice feature of CAB!!
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 11-Oct-2007 at 8:24am |
This is the best example that I found (copied from http://www.codeproject.com/useritems/XSModuleCompMppr.asp):
=========================
Event Publication
The publication handler itself...
[EventPublication("evt://XS/Generic/Foo")] public event EventHandler<DataEventArgs<string>> BroadcastFoo;
Public method for invoking the publication handler from referring classes. While not required for events that should not be invoked except by the publishing class itself, if appropriate, provides an interface for referring classes that may also require invocation of the event, such as a view that may invoke an event defined on its owning presenter...
public void DoBroadcastFoo(object sender, string thisMessage) { this.BroadcastFoo(sender, new DataEventArgs<string>(thisMessage)); }
Event Subscription
[ EventSubscription("evt://XS/Generic/Foo")] [EventSubscription("evt://XS/Generic/Bar")] public void OnReceiveGeneric(object sender, DataEventArgs<string> e) { myObject.MyMethod(e.Data); }
=========================
Two namespaces must be referenced (not mentioned in article!):
Microsoft.Practices.CompositeUI.EventBroker
Microsoft.Practices.CompositeUI.Utility
I have not finished testing, but so far, I am getting no build errors.
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 11-Oct-2007 at 8:07am |
I wonder if any of these people who are writing about the EventBroker with EventPublication / EventSubscription have really, actually, successfully written a viable communication. NONE of their examples work...I have tried at least half a dozen scenarios. Perhaps, there is some other kind of hindrance from the DevForce/CAB combo.
Any tips or tricks about the EventBroker syntax, especially within DF/CAB, would be welcome.
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 10-Oct-2007 at 12:51pm |
Utilizing the event broker...that is what I was researching. It seems like the appropriate solution. I'll update here once I get it working. I am still working through the details.
|
|
Bill Jensen
IdeaBlade
Joined: 31-Jul-2007
Location: United States
Posts: 229
|
Post Options
Quote Reply
Posted: 10-Oct-2007 at 12:45pm |
You're right, the SharedEditor module is a bit complicated.
If you're wanting to pop up a WorkOrder view in a separate window, you can add it to the WindowWorkspace (with appropriate SmartPartInfo).
If you already have a WorkOrder view, you somehow have to get its data source set to the newly-created WorkOrder. You could pass this information in the ViewContexts of the two views. There would need to be a common controller that knows about both views.
I'd think carefully before trying to sync between modules, but if it were necessary, I'd probably use a CAB EventTopic.
Bill J.
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 08-Oct-2007 at 3:53pm |
As I understand Cabana, there is a separate SharedEditor module that is accessed via an EntityEditor service. While this is a fine (and quite complicated) solution, I would like to take advantage of views that are already built. I have a view in a module that is designed to add/edit/delete an entity. How do I access that view from another view (or even module) within the application?
|
|
Bill Jensen
IdeaBlade
Joined: 31-Jul-2007
Location: United States
Posts: 229
|
Post Options
Quote Reply
Posted: 08-Oct-2007 at 2:49pm |
At first glance, this sounds similar to the way SalesOrders are handled in Cabana. The whole purpose of the EntityManager structure is to provide a mechanism to keep multiple editors in sync without round-trips to the server.
Bill J.
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 08-Oct-2007 at 11:55am |
I have a view in a module that lists in a grid a certain entity (Parts). I have another view in the same module that add/edits a related entity (Work Order). Is it possible to create a new work order from the parts list view, then open the Work Order view to the newly created work order? If so (and I have high expectations that this is easy to do), how do I go about this the CAB way?
Thanks!
Bill
Edited by Linguinut - 11-Oct-2007 at 9:59am
|
|