all groups > dotnet distributed apps > december 2003 >
You're in the

dotnet distributed apps

group:

How to do in UIP



How to do in UIP george r smith
12/31/2003 1:19:31 PM
dotnet distributed apps: If I have a form that shows a list view of vendors, user selects a vendor by
double clicking. Now I have a vendor ID and want to navagate to a new form
that has the vendor detail. Question is how do I get this vendor ID to the
new form in the UIP.

grs

RE: How to do in UIP lukezhan NO[at]SPAM online.microsoft.com
1/2/2004 2:15:55 AM
Hi George,

There are two ways to achieve this, let use QuickStart Store Win sample for
explaining:

1. Declare a public property in a form and access the property in another
form. For example, in form Logon, there is a public property "UserName", we
can get its value in form checkout.

2. User a public class "StoreController" as datasource of a form. For
example, in form "cart":

Private Sub cart_Activated(sender As Object, e As System.EventArgs)
Handles MyBase.Activated
cartGrid.DataSource = StoreController.GetCartItems()
End Sub

In form "Browsecatalog", we change the CartItems in StoreController. When
we get back to form "cart", we get the values from StoreController.

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Re: How to do in UIP n33470 NO[at]SPAM yahoo.com
1/5/2004 7:04:25 AM
Hey George!

I wrestled with the same type of problem. I'm not sure if this will
exactly fit your situation, but it might point you in a different
direction.

I wanted to pass some data into the controller that was being used in
the views. Initially I thought I needed to create a new Task to do
this. Using the QuickStart Store Win sample, this would be analagous
to the "Cart" task. I couldn't get this technique to work because I
was using the MemoryStatePersistence, rather than
SQLServerStatePersistence...and for some reason I couldn't change the
QuickStart to use MemoryStartPersistence.

So I tried a different approach that's working fine for me. When I
use the UIPManager to start the task, I pass in arguments to the task.
Then each controller used in the navigation graph gets passed the
same arguments. Here's how I start the task:

string employeeId = "123";
UIPManager.StartTask( "MyGraph", null, new TaskArgumentsHolder(
Guid.Empty, "MyGraph", employeeId ) );

Now, when each controller gets started, they all get passed the same
arguments. In the controller class you get at the TaskArguments like
this:

public override void EnterTask( TaskArgumentsHolder taskArguments )
{
// taskArguments structure contains the employeeId being worked with
if( taskArguments != null && taskArguments.TaskArguments != null )
{
string empId = Convert.ToString( taskArguments.TaskArguments );
this.EmployeeId = empId;
}
}


Hope this helps!

Re: How to do in UIP george r smith
1/5/2004 10:06:35 AM
Steve,
Your solution makes sense to me. Thanks for taking the
time to reply.
grs

[quoted text, click to view]

Re: How to do in UIP george r smith
1/5/2004 10:32:10 AM
Steve and Luke,

Following the code (located in a controller) that I used to solve the
problem:

public int GetCurrentVendorNumber()
{
string key = "VendorNumber";
if (State.Contains(key))
return (int)State[key];
else
return 0;
}

public void ShowVendorMaintForm(int VendorNumber)
{
string key = "VendorNumber";
if (State.Contains(key))
State.Remove(key);

State.Add(key,VendorNumber);

// proceed to next view
State.NavigateValue = "ShowVendorMaintForm";
Navigate();
}


[quoted text, click to view]

Re: How to do in UIP lukezhan NO[at]SPAM online.microsoft.com
1/6/2004 10:23:40 AM
Hi george,

Thank you for the update. This indeed a proper solution in UIP way. Thank
you for the share.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
AddThis Social Bookmark Button