Thursday, August 12, 2004

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);

navigator.StartTask(holder);

}

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");
UIPManager.StartNavigationTask("StartupParams",holder);

That's all there is to it.





Tuesday, August 24, 2004 5:22:20 PM (GMT Standard Time, UTC+00:00)
Hi Brian,

I followed your suggestions for the problem of starting tasks with arguments, and it works excellent. Thanks again.

But, in this comment I would like to address one more problem in working with UIPAB. It is: Working with multiple tasks.
I described this problem on GotDotNet UIPAB Message board few hours ago:
http://www.gotdotnet.com/Community/MessageBoard/Thread.aspx?id=257391

I tried to test the Block with Quickstart sample MultiNavGraph(WinApp) and it works pretty fine with multiple windows (started new tasks). It differs states of tasks properly, unlike in my web application. I was wondering if it might be a problem in OpenNavigator I am using, while in MS sample GraphNavigator is used.

Can you, please, give some advise where to look, or what to check in order to solve this problem. It is certainly true that UIPAB support multiple tasks as I went trough source code to see how it save state. It saves state in session state by taskId, which allows to perfectly sepparate states for each started task.
Sergian
Thursday, February 23, 2006 6:49:38 AM (GMT Standard Time, UTC+00:00)
Hai Brian,

i am now doing clickonce for application, my application has a command line argument. how can i pass that to my exe.

during launch my application through explorer i use this
http://mydeploymentserver/MyApplicationFolder/MyApplication.application?param1=Test

how can i do the same thing with the exe in the STRART UP.
Solve my problem.

Amjath
Comments are closed.









Ads by Lake Quincy Media









Sign In
Copyright © 2006-2007 Brian Noyes. All rights reserved.
Advertise on this site through Lake Quincy Media
designed by NUKEATION STUDIOS