Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

ParameterBinding

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-06-2006   #1 (permalink)
chirag
Guest


 

ParameterBinding

ublic override void SetValue(object component, object value)
{
if (component != null)
{
ISite site = GetSite(component);
IComponentChangeService changeService = null;
if (site != null)
changeService =
(IComponentChangeService)site.GetService(typeof(IComponentChangeService));
// Raise the OnComponentChanging event
changeService.OnComponentChanging(component, this);

// Save the old value
object oldValue = GetValue(component);

try
{
WorkflowParameterBindingCollection parameters =
GetParametersPropertyValue(component);
if (parameters != null)
{
if (value == null)
// Remove the binding from the
ParameterBindings collection
parameters.Remove(this.Name);
else
{
// Add the binding to the ParameterBindings
collection
WorkflowParameterBinding binding = null;
if (parameters.Contains(this.Name))
binding = parameters[this.Name];
else
{
binding = new
WorkflowParameterBinding(this.Name);
parameters.Add(binding);
}

// Set the binding value on the
ParameterBindings collection correspondent binding item
if (value is ActivityBind)

binding.SetBinding(WorkflowParameterBinding.ValueProperty, value as
ActivityBind);
else

binding.SetValue(WorkflowParameterBinding.ValueProperty, value);
}
}
// Raise the OnValueChanged event
OnValueChanged(component, EventArgs.Empty);
}
catch (Exception)
{
value = oldValue;
throw;
}
finally
{
if (changeService != null)
// Raise the OnComponentChanged event
changeService.OnComponentChanged(component,
this, oldValue, value);
}
}
}

/// <summary>
/// Returns a component binding value from the
ParameterBindings collection.
/// </summary>
/// <param name="component"></param>
/// <returns></returns>
public override object GetValue(object component)
{
WorkflowParameterBindingCollection parameters =
GetParametersPropertyValue(component);
if (parameters != null && parameters.Contains(this.Name))
{
if
(parameters[this.Name].IsBindingSet(WorkflowParameterBinding.ValueProperty))
return
parameters[this.Name].GetBinding(WorkflowParameterBinding.ValueProperty);
else
return
parameters[this.Name].GetValue(WorkflowParameterBinding.ValueProperty);
}
return null;
}

/// <summary>
/// Returns the ParameterBindings collection of the
activity component.
/// </summary>
/// <param name="component"></param>
/// <returns></returns>
private static WorkflowParameterBindingCollection
GetParametersPropertyValue(object component)
{
WorkflowParameterBindingCollection
parameterBindingCollection = null;

MemberInfo memberInfo =
component.GetType().GetProperty("ParameterBindings",
BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance
| BindingFlags.FlattenHierarchy | BindingFlags.ExactBinding, null,
typeof(WorkflowParameterBindingCollection), new Type[] { }, new
ParameterModifier[] { });
if (memberInfo != null)
parameterBindingCollection =
component.GetType().InvokeMember("ParameterBindings",
BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance
| BindingFlags.FlattenHierarchy | BindingFlags.ExactBinding, null,
component, new object[] { }, CultureInfo.InvariantCulture) as
WorkflowParameterBindingCollection;
return parameterBindingCollection;
}
}
I have written the above code and still I am not able to bind the
parameters please solve my problem
thanks


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes




Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51