Friday, July 16, 2010

How to add help to a "VeroMark" semantic client builder user interface

Aaah, application help, who can get by without it? Luckily, you can add context sensitive help easily to your VeroMark application client.

VeroMark’s help system can access compiled chm files or html files either locally or by http. By default, VeroMark accesses help content from a help url constructed from a concatenated path and HelpString, but can also be configured to access help content from a path and HelpString separately.


The following VeroMark configuration file appSettings cause it to append a context-sensitive HelpString to the base url http://server/path/VeroMark/default.aspx?pageid= when accessing help content. It also specifies that the default HelpString is Welcome for use when a context-specific HelpString is not available. Given these settings, VeroMark’s help system will access the url http://server/path/VeroMark/default.aspx?pageid=Welcome when your user presses the F1 key and no context-specific HelpString is available.



    <add key="[company].Inventory.SPI.MainWindow.AppendHelpstringToUrl" value="true"   />
    <add key="[company].Inventory.SPI.MainWindow.HelpUrl" value="http://server/path/VeroMark/default.aspx?pageid="   />
    <add key="[company].Inventory.SPI.HelpProvider.HelpstringDefault" value="Welcome"   />

VeroMark defaults the first entry to “true” when not included in the configuration file. To access traditional chm files, make sure to include the first configuration entry but set it to “false” as follows:



    <add key="[company].Inventory.SPI.MainWindow.AppendHelpstringToUrl" value="false"   />
    <add key="[company].Inventory.SPI.MainWindow.HelpUrl" value="C:\path\sample.chm   />
    <add key="[company].Inventory.SPI.HelpProvider.HelpstringDefault" value="sample.chm::/compiledHtmlPage.htm"   />

Context-specific HelpStrings are configured within VeroMark Page markup by setting the HelpProvider.HelpString property on FrameworkElements as follows:

<Page xmlns:ns="clr-namespace:[company].Inventory.SPI;assembly=SPIControls"
      ....
      ns:HelpProvider.HelpString="stringToAppendToHelpUrl">


Now, for example, when a user has focus on a child FrameworkElement within this Page which doesn’t have a context-specific HelpString configured, pressing F1 will cause VeroMark’s help system to access http://server/path/VeroMark/default.aspx?pageid=stringToAppendToHelpUrl .

VeroMark’s help system first checks to see if the FrameworkElement with focus has a context-specific HelpString configured. If it doesn’t, it then checks to see if the FrameworkElement that caught the F1 event has one. If it also doesn’t, it defaults to the HelpStringDefault configured in VeroMark’s configuration file.


Context-specificity can be increased by adding HelpStrings to children deeper into the LogicalTree. The following markup, within the same Page, causes VeroMark’s help system to access http://server/path/VeroMark/default.aspx?pageid=stringToAppendToHelpUrlWhenControlHasFocus when the SpiTextBox has focus and a user presses the F1 key.

         ...
         <ns:SpiTextBox Grid.Column="1" Width="400" TextWrapping="Wrap"
            Style="{StaticResource MValueTextBoxStyle}" 
            ns:HelpProvider.HelpString="stringToAppendToHelpUrlWhenControlHasFocus";
            Text="{Binding Source={StaticResource CurrentEntity}, Path=[MValue_PartyName_Categories_Pronunciation].StringValue, 
            Mode=TwoWay, 
            TargetNullValue={x:Static System:String.Empty}}"/>
                  ...

If SpitextBox is the only FrameworkElement within this Page to have HelpString context-specificity, focus on other FrameworkElement's within the Page will still default back to the Page's HelpString setting and access http://server/path/VeroMark/default.aspx?pageid=stringToAppendToHelpUrl when a user presses the F1 key.

Thanks to VeroMark’s help system, you can deliver context-sensitive help content to users of your VeroMark application. All that’s left for you to do now is author content that will help your users in a useful, informative, logical, consistent, accurate, and compelling way when they encounter unexpected problems in the future. No prob!

No comments:

Post a Comment