More complex composition and dynamic content samples?

Topics: Prism v2 - Silverlight 2
May 18, 2009 at 1:53 AM
Edited May 18, 2009 at 1:54 AM

I’m doing some spiking with Prim v2 and Silverlight 2.  The sample and quick starts demonstrate mostly static dashboard style content.  Are there any samples out there for more dynamic content?

For a medium to larger scale application that we’ll be embarking on the primary Shell will essentially be an open workspace containing more specifically designed sub shells.   

To explain: Before login there should be a simple welcome screen with a view of public information. After they’ve logged in, the welcome and login screen is replaced by a sidebar navigation list and a dashboard that suits their role within the application.  The user can navigate to different areas using the sidebar or drill down into specific items and each area will be composited of its own local views.

I’m interested in an sample application that shows best practice for how the lifetime of these different composited views can be managed.  And other related issues. For instance how a particular view will know it is being navigated away from,  and can cancel and prompt the user to save/cancel instead etc.

Is any such sample in the pipeline or is there one out there now that I’ve missed?  It would be of great benefit to speed the adoption of CAL + Silverlight.


Thanks

Aaron

 

May 18, 2009 at 6:50 PM

I am too very interested. I have a more simple needs. I just need user to be able to compose a layout with predefined UI elements. So he could add, delete, resize, drag and drop to change location on the screen.

http://www.mscui.net/PatientJourneyDemonstrator/ this is what I ideally want to achieve (Administrator Demonstrator). How Prism can help me to do that?

May 18, 2009 at 7:35 PM

Hi Aaron,

 

It’s great that you are starting to use the Composite Application Guidance for WPF & Silverlight and I hope you are liking it.

 

The scenario you are trying to achieve is one that is well supported by Prism-v2. Dynamically changing the content of regions will be the thing you will most likely use to modify the UI after login and when a user navigates to a different item in the sidebar. In some cases scoped regions could be also useful if you have a view that will contain views inside (placed in regions).

The Stock Trader RI for Silverlight, although it is not the same scenario, has some shell updates with creation and displays of different views (after Buy/Sell button clicks), which you might find useful.

Erwin Van Der Valk, developer in the Prism-v2 project, has created an Outlook style sample application that also shows different a different UI based on user input (sort of from a sidebar). It is in WPF, but you might be able to get some useful ideas out of it.

 

As for the active view, the following thread deals with a similar issue:

·         Using IActiveAware

 

There are several features from prism that might help you achieve your scenario. You might find some of them in the following articles:

·         Modularity

·         Shell and View

·         Communication

·         UI Composition

 

Please let me know if this helps.

 

Damian Schenkelman

http://blogs.southworks.net/dschenkelman

May 19, 2009 at 4:41 AM
Edited May 19, 2009 at 4:43 AM

Hi Damian,

I do like CAL and the UnityContainer is pretty nice too. I like it a lot more than CAB when I investigated that a few years ago.

I'm thinking what CAL does with Regions I could also do with navigation. I'm playing around with the UnityContainer in IModule.Initialize like so:

            // Subscribe to navigation events
            _EventAggregator.GetEvent<NavigateEvent>().Subscribe(OnNavigate);

            // Register the navigable views
            _Container.RegisterType<INavigableView, PublicView>(NavigableViewNames.Home, new ContainerControlledLifetimeManager());
            _Container.RegisterType<INavigableView, RegisterForm>(NavigableViewNames.Register);
                      
            // Navigate to Home
            _EventAggregator.GetEvent<NavigateEvent>().Publish(new NavigateInfo(NavigableViewNames.Home));

I might add to the INavigableView interface a CanClose() or some such method.  And also thinking of ways to extend it to have pseudo bread crumbs. Maybe by tying the hierarchy to a container or region hierarchy...  Does this direction seem like a pretty sane course?  I'm conscious I don't want to add too much infrastructure to what is already there in CAL and everything else.

Generally I'm trying to avoid the WPF examples as my Silverlight skill is still very nacient in order to avoid being confused by the WPF xaml differences. I spent longer than I care to admit trying to find out why:  cal:RegionManager.RegionName="{x:Static inf:RegionNames.MainRegion}"  wasn't working for me and then realised I had the wrong Shell.xaml opened in the StockTraderRI solution. And learnt Silverlight doesn't support static resources. (Previously I was searching the whole solution and it had made it an open tab.)  I've now hidden the desktop folder in my local version of it.

I like some ideas from Erwin's Outlook example, however I get SynchronizationLockException when I run it.  Anyway I'll post a comment about it on his blog.  Calling a ViewModel, a UseCase is a bit of a leap for me though... 

Anyway thanks for the direction.

Aaron