![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |