Navigation


Milos Solution Platform (External Blog)

The Milos Solution Platform is .NET's premier platform for building business applications. This blog is meant for developers who use or evaluate Milos. This blog is used to share tidbits of information provided by the Milos developers at EPS. Many of the posts put the spotlight on new features. We generally recommend that all Milos users (developers) at least scan this blog to keep up with the Milos news.

Content Area Footer

Sunday, September 09, 2007
Automatic Window Title Updates on Navigation

Here is a small but nice tweak: When using navigation UIs, in particular the Office application forms, or the Developer Express application forms, Milos now supports automatic updates of the windows title (the secondary title, actually), from the pane's caption (the pane the user navigates to). This behavior is optional, and can be controlled by means of the UpdateWindowSubTitleFromNavigation property, which can be found on all app form classes.

Note: Related to this change is an update to the INavigationHost interface, which now features a NavigationCompleted event. If you implement this interface somewhere, you simply need to add that event to your implementation as well. The code required to do so is simple:

/// <summary>
/// Occurs after a navigation.
/// </summary>
public event System.EventHandler NavigationComplete; 

Whether you actually use the event or not is up to you. However, we recommend you call if after navigating, which is done in the Navigate() method that goes with the same interface. Here is the new standard implementation for that method: 

/// <summary>
/// Triggers a navigation based on the specified URI
/// </summary>
/// <param name="uri">URI to navigate to</param>
/// <param name="ignoreNavigationHistory">Defines whether the current navigation needs
/// to be added to the navigation history. For instance, a go-back operation is already
/// in the history and thus does not have to be added, while a navigation to a new location
/// has to be added to the history.</param>
/// <returns>True if navigation is successful</returns>
public bool Navigate(string uri, bool ignoreNavigationHistory)
{
    bool retVal = NavigationHelper.Navigate(uri, this.History, this, ignoreHistory,
        this.ForwardControls, this.BackwardControls, this);
    if (this.NavigationComplete != null)
    {
        this.NavigationComplete(this, new EventArgs());
    }
    return retVal;
}
 

That's it! Small change, but nice to have.

  

Posted @ 3:09 AM by Egger, Markus (markus@code-magazine.com) -
Comments (19)


Saturday, September 08, 2007
Query Simplification

As some of you may know (although not all... which is what we are trying to address), the Milos DataService classes provide a simple way to query multiple records by multiple field names. For instance, if you want to query all customer with a last name of "Pronger" and a first name of "Chris" and active status, then you have been able to simply do this (in a business object):

string[] fieldNames = new string[] { "FirstName", "LastName", "IsActive" };
object[] parameters = new object[] { "Chris", "Pronger", true };
IDbCommand command = this.DataService.BuildQueryCommand("Customers", "*", fieldNames, parameters, DataRowProcessMethod.IndividualCommands);
DataSet customers = this.ExecuteQuery(command);

This is nice, but a lot of people do not know that this functionality exists. Besides, there really is no reason why people would have to know about this somewhat hidden method on the DataService. For this reason, we added a few convenience methods right on the business object that are easier to discover:

string[] fieldNames = new string[] { "FirstName", "LastName", "IsActive" };
object[] parameters = new object[] { "Chris", "Pronger", true };
IDbCommand command = this.GetQueryCommand("Customers", "*", fieldNames, parameters);
DataSet customers = this.ExecuteQuery(command);
 

Or, to make things simpler yet:

string[] fieldNames = new string[] { "FirstName", "LastName", "IsActive" };
object[] parameters = new object[] { "Chris", "Pronger", true };
DataSet customers = this.Query("Customers", "*", fieldNames, parameters);
 

There really is no particular reason for using GetQueryCommand() over Query(), unless you want to first retrieve the command object and then make further modifications on the object (which is hardly ever done). So just use Query().

The values in the field and filter list are all handled as "and" parameters. Also, all fields are used "as is" with no added wild cards. For instance, passing in "Pron" as the last name will not include "Pronger" in the result set. However, it is possible to pass in "Pron%" which will include "Pronger"s, assuming the database understands that wildcard character.

 

Posted @ 1:02 PM by Egger, Markus (markus@code-magazine.com) -
Comments (4)


 

 

 

 

 

 

 

Syndication RSS 2.0 RSS 2.0

All My Blogs:
My personal blogs:
Dev and Publishing Dev and Publishing
Travel and Internat. Living Travel and Internat. Living
Other blogs I contribute to:
Milos Blog (US) Milos Blog (US)
VFPConv. Dev Blog (US) VFPConv. Dev Blog (US)
VFPConv. Dev Blog (DE) VFPConv. Dev Blog (DE)

 

Blog Archives
All Blog Posts

2010
    November (1)
2009
    July (2)
    February (2)
    January (1)
2008
    December (1)
    October (3)
    June (1)
    April (3)
    February (1)
    January (1)
2007
    December (1)
    October (2)
    September (2)
    July (1)
    June (2)
    May (4)
    April (6)
    March (8)
    February (3)
    January (2)
2006
    December (2)
    November (2)

 

 

 

This Blog is powered by MilosTM Collaboration Components.