Consider a webapplication existing of 3 pages: p1, p2 and p3.
The default navigateGraph is: p1 -> p2 -> p3
The alternative navigateGraph is: p2 -> p1 -> p3
I want previous/next buttons on the pages. For the default graph there
should be only a 'next' button on page p1. But for the alternative
graph there should be both a 'next' and a 'previous' button.
Is it possible for a page (inheriting WebFormView) to determine the
current navigateGraph, current node and the available 'navigateTo'
nodes?
In that case I can question whether a page has a next and/or previous
page.
Thanks in advance,
Taco Ditiecher.
Paige Porter-Buhl - 29 Jan 2004 20:56 GMT
I explored the base code and discovered that if it is possible to
determine 'navigate to' nodes it would take more time than I had to
exend the UI Process blocks to do so. What I did is create several nodes
with the same navigate value but with different views associated with
this value. Example:
<node view='PlanOptions'>
<navigateTo navigateValue="Back" view='PlanFavorites' />
<navigateTo navigateValue="PlanHome" view='PlanHome' />
<navigateTo navigateValue="Next" view='PlanPreferences' />
<navigateTo navigateValue="Skip" view='PlanMainCategory' />
</node>
<node view='PlanPreferences'>
<navigateTo navigateValue="Back" view='PlanOptions' />
<navigateTo navigateValue="PlanHome" view='PlanHome' />
<navigateTo navigateValue="Next" view='PlanNut' />
</node>
Then I created a single naviation user control with 'next', 'back',
'skip' etc buttons. In this user control I created a reference to the
mutual controller for all the webform views. This way, when one of the
buttons - lets say 'next' - is clicked, I was able to run one line of
code in the user control to handle the navigation no matter what page it
was on:
public Controllers.MenuPlannerController thiscontroller{
get{
WebFormView thisview=(WebFormView)this.Page;
return (Controllers.MenuPlannerController)thisview.Controller;
}
}
protected void next_OnClick(object sender, System.EventArgs e){
thiscontroller.Go("Next");}
Now, I've got a question for you. I am a web programmer who is designing
a large application that the client wants to eventually make into a
desktop application or adapt for other uses. I originally thought that
the UIProcess blocks were ideal to use but I've discovered that creating
these nodes and reworking the pages to minimize postbacks and use the
statemanagement take a lot of work beyond just keeping a clear division
between logic and UI. I'm wondering if its really worth this effort and
I don't have the desktop app experience or the experience with
converting one type of program to another to evaluate this. Have you
done this type of 'conversion' before? What types of problems need to be
addressed? Is 'wiring-up' to the App Blocks and efficient way of
addressing these problems?
Dean Nero - 30 Nov 2004 19:03 GMT
I was able to do this my slightly modifying the application block.
I changed the _navigatetosettings from private to public
I needed to do this because I could find no accessor method
---------------------------------------------
public NavigateToSettings this[ string navigateValue ]
{
get{ return (NavigateToSettings)navigateToCollection[ navigateValue ]; }
}
--------------------------------------------
here is the code that examines the collection, with all of the unnecessary stuff from my app removed
note your need to add the following references
using Momentum.Foundation.UserInterfaceProcess;
using System.Collections.Specialized;
-------------------------------
bool ViewExistsInNavigationGraph(string navigationGraphName, string viewName, string viewnameToCheck)
{
NavigationGraphSettings settings = UIPConfiguration.Config.GetNavigationGraphSettings(navigationGraphName);
HybridDictionary navigateCollection;
//
//Get the node which matches the current view in the navigationgraph
//
foreach (NodeSettings node in settings.Views())
{
if (node.View == viewName)
//
// node for current view found...now look in the navigateto collection to see the details of each view
//
{
navigateCollection = node.navigateToCollection;
foreach (System.Collections.DictionaryEntry dictEntry in navigateCollection)
{
if(dictEntry.Key.ToString() == viewnameToCheck)
{
// WE FOUND IT....get the view name for tthe current node
view_name = ((Microsoft.ApplicationBlocks.UIProcess.NavigateToSettings)(((System.Object)((dictEntry.Value))))).View;
}
}
}
}
return false;
}---------------------------------------------
Hope this helps
Dean Nero
Momentum Healtheware Inc
Winnipeg, Manitoba, Canada