/*  private void MergeParameterItems(WfParameterNeedToBeCollected items, WfParameterNeedToBeCollected wfParameters)
         * {
         *   foreach (WfParameterDescriptor item in wfParameters)
         *   {
         *       if (!items.ContainsKey(item.ParameterName))
         *       {
         *           items.Add(item);
         *       }
         *   }
         * } */

        private void CollectParameter(WfParameterDescriptor wfpd)
        {
            Control control = WebControlUtility.FindControlByID(this.Page, wfpd.ControlID, true);

            if (control != null)
            {
                //控件对象路径
                string targetPro = string.Empty;
                //控件对象属性
                string targetProName = wfpd.ControlPropertyName;

                DataBindingControl.SplitPath(control, wfpd.ControlPropertyName, out targetPro, out targetProName);

                //获取目标属性值
                object targetItem = DataBindingControl.FindObjectByPath(control, targetPro);

                if (targetItem != null)
                {
                    object targetValue = DataBindingControl.FindObjectByPath(targetItem, targetProName);

                    Type realType = typeof(string);

                    if (wfpd.ParameterType.TryToRealType(out realType))
                    {
                        this.CurrentProcess.ApplicationRuntimeParameters[wfpd.ParameterName] = DataConverter.ChangeType(targetValue, realType);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            /*
             * PropertyDescriptor member = TypeDescriptor.GetProperties(context.Instance)["ItemBindings"];
             * System.Web.UI.Design.ControlDesigner.InvokeTransactedChange((Component)context.Instance, new TransactedChangeCallback(this.InnerEditValues), null, null, member);
             */

            DataBindingControl        control  = (DataBindingControl)context.Instance;
            DataBindingItemCollection bindings = (DataBindingItemCollection)control.ItemBindings;
            DataBindingItem           binding  = new DataBindingItem();

            binding.ControlID = "Shen Zheng";
            bindings.Add(binding);

            context.OnComponentChanged();
            return(bindings);
        }
 public DataBindingInnerValidationControl(DataBindingControl bindingControl)
 {
     this.BindingControl = bindingControl;
 }