Passing Arguments when starting a task in UIP

Version 2 of the UIP application block came out back in April, and included a lot of new functionality. Unfortunately, they also broke one important capability in moving from v1 to v2: the ability to pass in an set of initialization arguments to get a task initialized.

In V1, there was an overload of the UIPManager.StartTask method that allowed you to pass in an instance of a TaskArgumentsHolder object, which itself has a placeholder TaskArguments object reference where you could stuff anything you needed to pass downstream to the task that is being launched, such as user login info, command line or querystring params, etc.

This disappeared in V2 with the move to multiple navigation models. However, the fix is pretty straightforward to get that capability back – it just involves making a minor tweak to the UIP library source code, which is not a problem since you get full source code with the block.

Basically, what you need to do is go into the Navigators folder within the UIP project, and for each navigator type you want to support arguments on, you need to change the visibility of the StartTask method that takes a TaskArgumentsHolder parameter from private to either internal or public:

public void StartTask(TaskArgumentsHolder holder) { … }

Then go into the UIPManager class, and add an overload for each of the StartXXTask methods that takes a nav graph name and a TaskArgumentsHolder, and have it call the appropriate StartTask on the appropriate navigator:

public static void StartNavigationTask(string navGraph, TaskArgumentsHolder holder)


GraphNavigator navigator = new GraphNavigator(navGraph);



As soon as you do that, you are back in business. You can start a task and pass in arguments with something like this:

TaskArgumentsHolder holder = new TaskArgumentsHolder(Guid.Empty,null,”startupargs”);

That’s all there is to it.