internal static void Flush_Rules_DT(IServiceProvider serviceProvider, Activity activity)
        {
            RuleDefinitions definitions = (RuleDefinitions)activity.GetValue(RuleDefinitions.RuleDefinitionsProperty);

            if (definitions != null)
            {
                WorkflowDesignerLoader service = (WorkflowDesignerLoader)serviceProvider.GetService(typeof(WorkflowDesignerLoader));
                if (service != null)
                {
                    string filePath = string.Empty;
                    if (!string.IsNullOrEmpty(service.FileName))
                    {
                        filePath = Path.Combine(Path.GetDirectoryName(service.FileName), Path.GetFileNameWithoutExtension(service.FileName));
                    }
                    filePath = filePath + ".rules";
                    using (TextWriter writer = service.GetFileWriter(filePath))
                    {
                        if (writer != null)
                        {
                            using (XmlWriter writer2 = System.Workflow.Activities.Common.Helpers.CreateXmlWriter(writer))
                            {
                                DesignerSerializationManager serializationManager = new DesignerSerializationManager(serviceProvider);
                                using (serializationManager.CreateSession())
                                {
                                    new WorkflowMarkupSerializer().Serialize(serializationManager, writer2, definitions);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        internal static void Flush_Rules_DT(IServiceProvider serviceProvider, Activity activity)
        {
            RuleDefinitions rules = (RuleDefinitions)activity.GetValue(RuleDefinitions.RuleDefinitionsProperty);

            if (rules != null)
            {
                WorkflowDesignerLoader loader = (WorkflowDesignerLoader)serviceProvider.GetService(typeof(WorkflowDesignerLoader));
                if (loader != null)
                {
                    string rulesFileName = string.Empty;
                    if (!string.IsNullOrEmpty(loader.FileName))
                    {
                        rulesFileName = Path.Combine(Path.GetDirectoryName(loader.FileName), Path.GetFileNameWithoutExtension(loader.FileName));
                    }
                    rulesFileName += ".rules";

                    using (TextWriter ruleFileWriter = loader.GetFileWriter(rulesFileName))
                    {
                        if (ruleFileWriter != null)
                        {
                            using (XmlWriter xmlWriter = Helpers.CreateXmlWriter(ruleFileWriter))
                            {
                                DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(serviceProvider);
                                using (designerSerializationManager.CreateSession())
                                {
                                    new WorkflowMarkupSerializer().Serialize(designerSerializationManager, xmlWriter, rules);
                                }
                            }
                        }
                    }
                }
            }
        }
        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
        {
            if (typeDescriptorContext == null)
            {
                throw new ArgumentNullException("typeDescriptorContext");
            }
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            object obj2 = o;
            WorkflowDesignerLoader loader = serviceProvider.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;

            if ((loader != null) && loader.InDebugMode)
            {
                throw new InvalidOperationException(Messages.DebugModeEditsDisallowed);
            }
            RuleSetReference instance = typeDescriptorContext.Instance as RuleSetReference;

            if (((instance == null) || (instance.RuleSetName == null)) || (instance.RuleSetName.Length <= 0))
            {
                throw new ArgumentException(Messages.RuleSetNameNotSet);
            }
            Activity          component = null;
            IReferenceService service   = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;

            if (service != null)
            {
                component = service.GetComponent(typeDescriptorContext.Instance) as Activity;
            }
            RuleSetCollection ruleSets    = null;
            RuleDefinitions   definitions = ConditionHelper.Load_Rules_DT(serviceProvider, System.Workflow.Activities.Common.Helpers.GetRootActivity(component));

            if (definitions != null)
            {
                ruleSets = definitions.RuleSets;
            }
            if ((ruleSets != null) && !ruleSets.Contains(instance.RuleSetName))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Messages.RuleSetNotFound, new object[] { instance.RuleSetName }));
            }
            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (this.editorService != null)
            {
                RuleSet ruleSet = ruleSets[instance.RuleSetName];
                using (RuleSetDialog dialog = new RuleSetDialog(component, ruleSet))
                {
                    if (DialogResult.OK == this.editorService.ShowDialog(dialog))
                    {
                        obj2 = dialog.RuleSet;
                    }
                }
            }
            return(obj2);
        }
        protected override void DoDefaultAction()
        {
            base.DoDefaultAction();
            WorkflowDesignerLoader service = this.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;

            if ((service != null) && service.InDebugMode)
            {
                throw new InvalidOperationException(Messages.DebugModeEditsDisallowed);
            }
            PolicyActivity activity = (PolicyActivity)base.Activity;

            if (!System.Workflow.Activities.Common.Helpers.IsActivityLocked(activity))
            {
                RuleDefinitions definitions = ConditionHelper.Load_Rules_DT(this, System.Workflow.Activities.Common.Helpers.GetRootActivity(activity));
                if (definitions != null)
                {
                    RuleSetCollection ruleSets         = definitions.RuleSets;
                    RuleSetReference  ruleSetReference = activity.RuleSetReference;
                    RuleSet           ruleSet          = null;
                    string            key = null;
                    if ((ruleSetReference != null) && !string.IsNullOrEmpty(ruleSetReference.RuleSetName))
                    {
                        key = ruleSetReference.RuleSetName;
                        if (ruleSets.Contains(key))
                        {
                            ruleSet = ruleSets[key];
                        }
                    }
                    else
                    {
                        key = ruleSets.GenerateRuleSetName();
                    }
                    using (RuleSetDialog dialog = new RuleSetDialog(activity, ruleSet))
                    {
                        if (DialogResult.OK == dialog.ShowDialog())
                        {
                            if (ruleSet != null)
                            {
                                ruleSets.Remove(key);
                            }
                            else
                            {
                                dialog.RuleSet.Name       = key;
                                activity.RuleSetReference = new RuleSetReference(key);
                            }
                            ruleSets.Add(dialog.RuleSet);
                            ConditionHelper.Flush_Rules_DT(this, System.Workflow.Activities.Common.Helpers.GetRootActivity(activity));
                        }
                    }
                }
                TypeDescriptor.GetProperties(activity)["RuleSetReference"].SetValue(activity, activity.RuleSetReference);
            }
        }
Ejemplo n.º 5
0
        public RuleConditionDialog(Activity activity, CodeExpression expression)
        {
            if (activity == null)
            {
                throw (new ArgumentNullException("activity"));
            }

            InitializeComponent();

            ITypeProvider typeProvider;

            serviceProvider = activity.Site;
            if (serviceProvider != null)
            {
                IUIService uisvc = serviceProvider.GetService(typeof(IUIService)) as IUIService;
                if (uisvc != null)
                {
                    this.Font = (Font)uisvc.Styles["DialogFont"];
                }
                typeProvider = (ITypeProvider)serviceProvider.GetService(typeof(ITypeProvider));
                if (typeProvider == null)
                {
                    string message = string.Format(CultureInfo.CurrentCulture, Messages.MissingService, typeof(ITypeProvider).FullName);
                    throw new InvalidOperationException(message);
                }

                WorkflowDesignerLoader loader = serviceProvider.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
                if (loader != null)
                {
                    loader.Flush();
                }
            }
            else
            {
                // no service provider, so make a TypeProvider that has all loaded Assemblies
                TypeProvider newProvider = new TypeProvider(null);
                foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
                {
                    newProvider.AddAssembly(a);
                }
                typeProvider = newProvider;
            }

            RuleValidation validation = new RuleValidation(activity, typeProvider, false);

            this.ruleParser = new Parser(validation);

            InitializeDialog(expression);
        }
Ejemplo n.º 6
0
        public RuleConditionDialog(Activity activity, CodeExpression expression)
        {
            ITypeProvider provider;

            this.ruleExpressionCondition = new RuleExpressionCondition();
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }
            this.InitializeComponent();
            this.serviceProvider = activity.Site;
            if (this.serviceProvider != null)
            {
                IUIService service = this.serviceProvider.GetService(typeof(IUIService)) as IUIService;
                if (service != null)
                {
                    this.Font = (Font)service.Styles["DialogFont"];
                }
                provider = (ITypeProvider)this.serviceProvider.GetService(typeof(ITypeProvider));
                if (provider == null)
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Messages.MissingService, new object[] { typeof(ITypeProvider).FullName }));
                }
                WorkflowDesignerLoader loader = this.serviceProvider.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
                if (loader != null)
                {
                    loader.Flush();
                }
            }
            else
            {
                TypeProvider provider2 = new TypeProvider(null);
                foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    provider2.AddAssembly(assembly);
                }
                provider = provider2;
            }
            RuleValidation validation = new RuleValidation(activity, provider, false);

            this.ruleParser = new Parser(validation);
            this.InitializeDialog(expression);
        }
Ejemplo n.º 7
0
        public RuleSetDialog(Activity activity, RuleSet ruleSet)
        {
            if (activity == null)
            {
                throw (new ArgumentNullException("activity"));
            }

            InitializeDialog(ruleSet);

            ITypeProvider typeProvider;

            this.serviceProvider = activity.Site;
            if (this.serviceProvider != null)
            {
                typeProvider = (ITypeProvider)this.serviceProvider.GetService(typeof(ITypeProvider));
                if (typeProvider == null)
                {
                    string message = string.Format(CultureInfo.CurrentCulture, Messages.MissingService, typeof(ITypeProvider).FullName);
                    throw new InvalidOperationException(message);
                }

                WorkflowDesignerLoader loader = this.serviceProvider.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
                if (loader != null)
                {
                    loader.Flush();
                }
            }
            else
            {
                // no service provider, so make a TypeProvider that has all loaded Assemblies
                TypeProvider newProvider = new TypeProvider(null);
                foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
                {
                    newProvider.AddAssembly(a);
                }
                typeProvider = newProvider;
            }

            RuleValidation validation = new RuleValidation(activity, typeProvider, false);

            this.ruleParser = new Parser(validation);
        }
Ejemplo n.º 8
0
        internal static RuleDefinitions Load_Rules_DT(IServiceProvider serviceProvider, DependencyObject activity)
        {
            RuleDefinitions rules = (RuleDefinitions)activity.GetValue(RuleDefinitions.RuleDefinitionsProperty);

            if (rules == null)
            {
                WorkflowDesignerLoader loader = (WorkflowDesignerLoader)serviceProvider.GetService(typeof(WorkflowDesignerLoader));
                if (loader != null)
                {
                    string rulesFileName = string.Empty;
                    if (!string.IsNullOrEmpty(loader.FileName))
                    {
                        rulesFileName = Path.Combine(Path.GetDirectoryName(loader.FileName), Path.GetFileNameWithoutExtension(loader.FileName));
                    }
                    rulesFileName += ".rules";

                    try
                    {
                        using (TextReader ruleFileReader = loader.GetFileReader(rulesFileName))
                        {
                            if (ruleFileReader == null)
                            {
                                rules = new RuleDefinitions();
                            }
                            else
                            {
                                using (XmlReader xmlReader = XmlReader.Create(ruleFileReader))
                                    rules = new WorkflowMarkupSerializer().Deserialize(xmlReader) as RuleDefinitions;
                            }
                        }
                    }
                    catch (Exception)
                    {
                        rules = new RuleDefinitions();
                        //
                    }
                }
                activity.SetValue(RuleDefinitions.RuleDefinitionsProperty, rules);
            }
            return(rules);
        }
        internal static RuleDefinitions Load_Rules_DT(IServiceProvider serviceProvider, DependencyObject activity)
        {
            RuleDefinitions definitions = (RuleDefinitions)activity.GetValue(RuleDefinitions.RuleDefinitionsProperty);

            if (definitions == null)
            {
                WorkflowDesignerLoader service = (WorkflowDesignerLoader)serviceProvider.GetService(typeof(WorkflowDesignerLoader));
                if (service != null)
                {
                    string filePath = string.Empty;
                    if (!string.IsNullOrEmpty(service.FileName))
                    {
                        filePath = Path.Combine(Path.GetDirectoryName(service.FileName), Path.GetFileNameWithoutExtension(service.FileName));
                    }
                    filePath = filePath + ".rules";
                    try
                    {
                        using (TextReader reader = service.GetFileReader(filePath))
                        {
                            if (reader == null)
                            {
                                definitions = new RuleDefinitions();
                            }
                            else
                            {
                                using (XmlReader reader2 = XmlReader.Create(reader))
                                {
                                    definitions = new WorkflowMarkupSerializer().Deserialize(reader2) as RuleDefinitions;
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        definitions = new RuleDefinitions();
                    }
                }
                activity.SetValue(RuleDefinitions.RuleDefinitionsProperty, definitions);
            }
            return(definitions);
        }
Ejemplo n.º 10
0
        public RuleSetDialog(Activity activity, System.Workflow.Activities.Rules.RuleSet ruleSet)
        {
            ITypeProvider service;

            this.sortOrder = new bool[4];
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }
            this.InitializeDialog(ruleSet);
            this.serviceProvider = activity.Site;
            if (this.serviceProvider != null)
            {
                service = (ITypeProvider)this.serviceProvider.GetService(typeof(ITypeProvider));
                if (service == null)
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Messages.MissingService, new object[] { typeof(ITypeProvider).FullName }));
                }
                WorkflowDesignerLoader loader = this.serviceProvider.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
                if (loader != null)
                {
                    loader.Flush();
                }
            }
            else
            {
                TypeProvider provider2 = new TypeProvider(null);
                foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    provider2.AddAssembly(assembly);
                }
                service = provider2;
            }
            RuleValidation validation = new RuleValidation(activity, service, false);

            this.ruleParser = new Parser(validation);
        }
Ejemplo n.º 11
0
        protected override void DoDefaultAction()
        {
            base.DoDefaultAction();

            // Do not allow editing if in debug mode.
            WorkflowDesignerLoader workflowDesignerLoader = this.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;

            if (workflowDesignerLoader != null && workflowDesignerLoader.InDebugMode)
            {
                throw new InvalidOperationException(Messages.DebugModeEditsDisallowed);
            }

            // Do not allow editing if locked
            PolicyActivity activity = (PolicyActivity)this.Activity;

            if (Helpers.IsActivityLocked(activity))
            {
                return;
            }

            RuleDefinitions rules = ConditionHelper.Load_Rules_DT(this, Helpers.GetRootActivity(activity));

            if (rules != null)
            {
                RuleSetCollection ruleSetCollection = rules.RuleSets;
                RuleSetReference  ruleSetReference  = activity.RuleSetReference;
                RuleSet           ruleSet           = null;
                string            ruleSetName       = null;
                if (ruleSetReference != null &&
                    !string.IsNullOrEmpty(ruleSetReference.RuleSetName))
                {
                    ruleSetName = ruleSetReference.RuleSetName;
                    if (ruleSetCollection.Contains(ruleSetName))
                    {
                        ruleSet = ruleSetCollection[ruleSetName];
                    }
                }
                else
                {
                    ruleSetName = ruleSetCollection.GenerateRuleSetName();
                }
                using (RuleSetDialog dlg = new RuleSetDialog(activity, ruleSet))
                {
                    if (DialogResult.OK == dlg.ShowDialog())
                    {
                        if (ruleSet != null) // modifying
                        {
                            ruleSetCollection.Remove(ruleSetName);
                        }
                        else // creating
                        {
                            dlg.RuleSet.Name          = ruleSetName;
                            activity.RuleSetReference = new RuleSetReference(ruleSetName);
                        }
                        ruleSetCollection.Add(dlg.RuleSet);
                        ConditionHelper.Flush_Rules_DT(this, Helpers.GetRootActivity(activity));
                    }
                }
            }

            // force revalidation by setting a property
            TypeDescriptor.GetProperties(activity)["RuleSetReference"].SetValue(activity, activity.RuleSetReference);
        }
Ejemplo n.º 12
0
 public CustomMessageFilter(IServiceProvider provider, WorkflowView workflowView, WorkflowDesignerLoader loader)
 {
     this.serviceProvider = provider;
     this.workflowView    = workflowView;
     this.loader          = loader;
 }
Ejemplo n.º 13
0
        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
        {
            if (typeDescriptorContext == null)
            {
                throw new ArgumentNullException("typeDescriptorContext");
            }
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            object returnVal = o;

            // Do not allow editing if in debug mode.
            WorkflowDesignerLoader workflowDesignerLoader = serviceProvider.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;

            if (workflowDesignerLoader != null && workflowDesignerLoader.InDebugMode)
            {
                throw new InvalidOperationException(Messages.DebugModeEditsDisallowed);
            }

            // Do not allow editing expression if the name is not set.
            RuleSetReference ruleSetReference = typeDescriptorContext.Instance as RuleSetReference;

            if (ruleSetReference == null || ruleSetReference.RuleSetName == null || ruleSetReference.RuleSetName.Length <= 0)
            {
                throw new ArgumentException(Messages.RuleSetNameNotSet);
            }

            Activity baseActivity = null;

            IReferenceService rs = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;

            if (rs != null)
            {
                baseActivity = rs.GetComponent(typeDescriptorContext.Instance) as Activity;
            }

            RuleSetCollection ruleSetCollection = null;
            RuleDefinitions   rules             = ConditionHelper.Load_Rules_DT(serviceProvider, Helpers.GetRootActivity(baseActivity));

            if (rules != null)
            {
                ruleSetCollection = rules.RuleSets;
            }

            if (ruleSetCollection != null && !ruleSetCollection.Contains(ruleSetReference.RuleSetName))
            {
                string message = string.Format(CultureInfo.CurrentCulture, Messages.RuleSetNotFound, ruleSetReference.RuleSetName);
                throw new ArgumentException(message);
            }

            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService != null)
            {
                RuleSet ruleSet = ruleSetCollection[ruleSetReference.RuleSetName];
                using (RuleSetDialog dlg = new RuleSetDialog(baseActivity, ruleSet))
                {
                    if (DialogResult.OK == editorService.ShowDialog(dlg))
                    {
                        returnVal = dlg.RuleSet;
                    }
                }
            }
            return(returnVal);
        }
Ejemplo n.º 14
0
        private ValidationErrorCollection ValidateActivity(ValidationManager manager, ActivityBind bind, BindValidationContext validationContext)
        {
            ValidationError           item   = null;
            ValidationErrorCollection errors = new ValidationErrorCollection();
            Activity activity = manager.Context[typeof(Activity)] as Activity;

            if (activity == null)
            {
                throw new InvalidOperationException(SR.GetString("Error_ContextStackItemMissing", new object[] { typeof(Activity).Name }));
            }
            Activity request = Helpers.ParseActivityForBind(activity, bind.Name);

            if (request == null)
            {
                item = bind.Name.StartsWith("/", StringComparison.Ordinal) ? new ValidationError(SR.GetString("Error_CannotResolveRelativeActivity", new object[] { bind.Name }), 0x128) : new ValidationError(SR.GetString("Error_CannotResolveActivity", new object[] { bind.Name }), 0x129);
                item.PropertyName = base.GetFullPropertyName(manager) + ".Name";
            }
            else if ((bind.Path == null) || (bind.Path.Length == 0))
            {
                item = new ValidationError(SR.GetString("Error_PathNotSetForActivitySource"), 0x12b)
                {
                    PropertyName = base.GetFullPropertyName(manager) + ".Path"
                };
            }
            else
            {
                if (!bind.Name.StartsWith("/", StringComparison.Ordinal) && !ValidationHelpers.IsActivitySourceInOrder(request, activity))
                {
                    item = new ValidationError(SR.GetString("Error_BindActivityReference", new object[] { request.QualifiedName, activity.QualifiedName }), 0x12a, true)
                    {
                        PropertyName = base.GetFullPropertyName(manager) + ".Name"
                    };
                }
                IDesignerHost          service = manager.GetService(typeof(IDesignerHost)) as IDesignerHost;
                WorkflowDesignerLoader loader  = manager.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
                if ((service != null) && (loader != null))
                {
                    Type srcType = null;
                    if (service.RootComponent == request)
                    {
                        ITypeProvider provider = manager.GetService(typeof(ITypeProvider)) as ITypeProvider;
                        if (provider == null)
                        {
                            throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(ITypeProvider).FullName }));
                        }
                        srcType = provider.GetType(service.RootComponentClassName);
                    }
                    else
                    {
                        request.GetType();
                    }
                    if (srcType != null)
                    {
                        MemberInfo memberInfo = MemberBind.GetMemberInfo(srcType, bind.Path);
                        if ((memberInfo == null) || ((memberInfo is PropertyInfo) && !(memberInfo as PropertyInfo).CanRead))
                        {
                            item = new ValidationError(SR.GetString("Error_InvalidMemberPath", new object[] { request.QualifiedName, bind.Path }), 300)
                            {
                                PropertyName = base.GetFullPropertyName(manager) + ".Path"
                            };
                        }
                        else
                        {
                            Type memberType = null;
                            if (memberInfo is FieldInfo)
                            {
                                memberType = ((FieldInfo)memberInfo).FieldType;
                            }
                            else if (memberInfo is PropertyInfo)
                            {
                                memberType = ((PropertyInfo)memberInfo).PropertyType;
                            }
                            else if (memberInfo is EventInfo)
                            {
                                memberType = ((EventInfo)memberInfo).EventHandlerType;
                            }
                            if (!DoesTargetTypeMatch(validationContext.TargetType, memberType, validationContext.Access))
                            {
                                if (typeof(WorkflowParameterBinding).IsAssignableFrom(memberInfo.DeclaringType))
                                {
                                    item = new ValidationError(SR.GetString("Warning_ParameterBinding", new object[] { bind.Path, request.QualifiedName, validationContext.TargetType.FullName }), 0x624, true)
                                    {
                                        PropertyName = base.GetFullPropertyName(manager) + ".Path"
                                    };
                                }
                                else
                                {
                                    item = new ValidationError(SR.GetString("Error_TargetTypeMismatch", new object[] { memberInfo.Name, memberType.FullName, validationContext.TargetType.FullName }), 0x12d)
                                    {
                                        PropertyName = base.GetFullPropertyName(manager) + ".Path"
                                    };
                                }
                            }
                        }
                    }
                }
                else
                {
                    MemberInfo info2 = MemberBind.GetMemberInfo(request.GetType(), bind.Path);
                    if ((info2 == null) || ((info2 is PropertyInfo) && !(info2 as PropertyInfo).CanRead))
                    {
                        item = new ValidationError(SR.GetString("Error_InvalidMemberPath", new object[] { request.QualifiedName, bind.Path }), 300)
                        {
                            PropertyName = base.GetFullPropertyName(manager) + ".Path"
                        };
                    }
                    else
                    {
                        DependencyProperty dependencyProperty = DependencyProperty.FromName(info2.Name, info2.DeclaringType);
                        object             obj2 = BindHelpers.ResolveActivityPath(request, bind.Path);
                        if (obj2 == null)
                        {
                            Type fromType = null;
                            if (info2 is FieldInfo)
                            {
                                fromType = ((FieldInfo)info2).FieldType;
                            }
                            else if (info2 is PropertyInfo)
                            {
                                fromType = ((PropertyInfo)info2).PropertyType;
                            }
                            else if (info2 is EventInfo)
                            {
                                fromType = ((EventInfo)info2).EventHandlerType;
                            }
                            if (!TypeProvider.IsAssignable(typeof(ActivityBind), fromType) && !DoesTargetTypeMatch(validationContext.TargetType, fromType, validationContext.Access))
                            {
                                if (typeof(WorkflowParameterBinding).IsAssignableFrom(info2.DeclaringType))
                                {
                                    item = new ValidationError(SR.GetString("Warning_ParameterBinding", new object[] { bind.Path, request.QualifiedName, validationContext.TargetType.FullName }), 0x624, true)
                                    {
                                        PropertyName = base.GetFullPropertyName(manager) + ".Path"
                                    };
                                }
                                else
                                {
                                    item = new ValidationError(SR.GetString("Error_TargetTypeMismatch", new object[] { info2.Name, fromType.FullName, validationContext.TargetType.FullName }), 0x12d)
                                    {
                                        PropertyName = base.GetFullPropertyName(manager) + ".Path"
                                    };
                                }
                            }
                        }
                        else if ((obj2 is ActivityBind) && (request.Parent != null))
                        {
                            ActivityBind         bind2   = obj2 as ActivityBind;
                            bool                 flag    = false;
                            BindRecursionContext context = manager.Context[typeof(BindRecursionContext)] as BindRecursionContext;
                            if (context == null)
                            {
                                context = new BindRecursionContext();
                                manager.Context.Push(context);
                                flag = true;
                            }
                            if (context.Contains(activity, bind))
                            {
                                item = new ValidationError(SR.GetString("Bind_ActivityDataSourceRecursionDetected"), 0x12f)
                                {
                                    PropertyName = base.GetFullPropertyName(manager) + ".Path"
                                };
                            }
                            else
                            {
                                context.Add(activity, bind);
                                PropertyValidationContext propertyValidationContext = null;
                                if (dependencyProperty != null)
                                {
                                    propertyValidationContext = new PropertyValidationContext(request, dependencyProperty);
                                }
                                else
                                {
                                    propertyValidationContext = new PropertyValidationContext(request, info2 as PropertyInfo, info2.Name);
                                }
                                errors.AddRange(ValidationHelpers.ValidateProperty(manager, request, bind2, propertyValidationContext, validationContext));
                            }
                            if (flag)
                            {
                                manager.Context.Pop();
                            }
                        }
                        else if ((validationContext.TargetType != null) && !DoesTargetTypeMatch(validationContext.TargetType, obj2.GetType(), validationContext.Access))
                        {
                            item = new ValidationError(SR.GetString("Error_TargetTypeMismatch", new object[] { info2.Name, obj2.GetType().FullName, validationContext.TargetType.FullName }), 0x12d)
                            {
                                PropertyName = base.GetFullPropertyName(manager) + ".Path"
                            };
                        }
                    }
                }
            }
            if (item != null)
            {
                errors.Add(item);
            }
            return(errors);
        }