Print Page | Close Window

Multiple active views

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3380
Printed Date: 30-Apr-2025 at 7:03am


Topic: Multiple active views
Posted By: mikedfox
Subject: Multiple active views
Date Posted: 09-Apr-2012 at 7:30am
We currently are using PRISM for development, but it is more complicated that I'd like, so I'm very interested in the cocktail project.
 
One feature that makes PRISM so useful is the view/region management. In the TempHire video it was mentioned that it would be easy to implement multiple objects being editted at once, via a tab interface for example. However, other than with PRISM, I have never found that to be an easy thing to manage. Do you have any examples of using cocktail in a multi edit way, or any other kind of more complicated view composition?
 
 



Replies:
Posted By: mgood
Date Posted: 09-Apr-2012 at 10:39am
I don't have a ready example that I can send you, but I'll take some time to create a multi-edit version of TempHire, since I brought it up on the video.


Posted By: mgood
Date Posted: 09-Apr-2012 at 7:20pm
Mike,
I've created an MDI version of TempHire that demonstrates what you are looking for. Double clicking on a row opens the item. You can download it from my Skydrive.

https://skydrive.live.com/redir.aspx?cid=b37183c914f0fbe8&resid=B37183C914F0FBE8!209&parid=B37183C914F0FBE8!208&authkey=!AN0Ya37NsYMJIuw

You can use a diff tool to see what's different between the SDI and the MDI version. The difference is very minimal. Mostly changes around lifecycle and closing strategy of the VMs and a TabManager to manage the open tabs. 

I've modified both the WPF and the Silverlight version. In Silverlight, because the TabControl is badly broken I opted for a row of buttons to switch between the open items. The WPF version uses a TabControl instead. The code is identical, just different views.


Posted By: mikedfox
Date Posted: 10-Apr-2012 at 1:24pm
thanks Marcel


Posted By: giotis
Date Posted: 08-May-2012 at 2:41pm
I tried to create a new MDI different version but failed,

is
possible ?


link about image  http://docs.google.com/open?id=0BwsfMcd3_Ex2akNSbk5sX0wxb1U - http://docs.google.com/open?id=0BwsfMcd3_Ex2akNSbk5sX0wxb1U


Posted By: giotis
Date Posted: 08-May-2012 at 2:47pm
Every time clicked the button "Resource Management" to create a new Tab


Posted By: giotis
Date Posted: 08-May-2012 at 3:01pm
or to create new Tab from StaffingResource.Id

link http://docs.google.com/open?id=0BwsfMcd3_Ex2Rkg0LW5JeWVpWVk -   http://docs.google.com/open?id=0BwsfMcd3_Ex2QTdlNDgySHRTR0E - http://docs.google.com/open?id=0BwsfMcd3_Ex2QTdlNDgySHRTR0E http://docs.google.com/open?id=0BwsfMcd3_Ex2QTdlNDgySHRTR0E -


Posted By: giotis
Date Posted: 08-May-2012 at 3:11pm
sorry  this right link  http://docs.google.com/open?id=0BwsfMcd3_Ex2QTdlNDgySHRTR0E - http://docs.google.com/open?id=0BwsfMcd3_Ex2QTdlNDgySHRTR0E


Posted By: mgood
Date Posted: 08-May-2012 at 5:10pm
Yes, that can all be done. The answers are all in the MDI example.


Posted By: giotis
Date Posted: 25-May-2012 at 6:13pm
I studied extensively the cocktail and concluded that the object "DomainUnitOfWorkManager"
manage the "DomainUnitOfWork" for the creation and sharing of multiple object instances at runtime
but unique, one at a time. When we have same instance of "IWorkspace" more than once then we have a conflict
because we need to manage same "DomainUnitOfWork" objects and "DomainUnitOfWorkManager"does not leave us
because do not know who the owner is, behave as if there is only one owner, this is right but not an MDI
enviroment.
how to manage the incident?

comment
Very rightly at the new version you introduced the method "Refresh",
which fits well because in one instance we can delete a record and another instance should be informed accordingly.
-About "Refresh" a point here I think must be disable when state entity is modify because a silly Secretary
may delete pending entities-


Posted By: mgood
Date Posted: 25-May-2012 at 11:03pm
If I understand you correctly, you want to be able to open the same entity in more than one tab. What's the use case for that? If you edit the same entity in multiple tabs you'll create a concurrency conflict with yourself. That doesn't make much sense. You don't open the same document twice in Word, either. If the document is already open, Word brings it to the foreground. The MDI TempHire example does the same. Anyway, the ObjectManager manages instances by keys. You pick the key that makes sense for your scenario. You can create an artificial key, for example a GUID for each of the open tabs instead of using the entity ID, but again, I'm not sure from a user experience opening the same entity in multiple tabs makes much sense. 

I'm not quite understanding your second point. A word about deleting. I know in TempHire you can actually delete a StaffingResource, but deleting is very bad in general. It causes lots of problems if you actually delete records from the database. Generally, you should not delete, but instead mark the record as inactive/expired or something like that. 



Print Page | Close Window