private bool UpdateDragModelInternal() { if (!DataBindingDragDropAddTriggerHandler.IsEnabled((ITypeResolver)this.ProjectContext) || this.DragModel.InsertionPoint.Property != null || (this.DragModel.DataSource.Count > 1 || !this.UpdateRelativeSchemaPath()) || DataBindingModeModel.Instance.NormalizedMode == DataBindingMode.Default && this.DragModel.RelativeDropSchemaPath.CollectionDepth > 0) { return(false); } if (PlatformTypes.FrameworkElement.IsAssignableFrom((ITypeId)this.DragModel.TargetNode.Type)) { this.DragModel.DropFlags = DataBindingDragDropFlags.CreateElement; if (this.DragModel.RelativeDropSchemaPath.IsMethod) { this.DragModel.NewElementType = ProjectNeutralTypes.CallMethodAction; this.DragModel.NewElementProperty = DataBindingDragDropAddTriggerHandler.MethodNameProperty; } else { this.DragModel.NewElementType = ProjectNeutralTypes.InvokeCommandAction; this.DragModel.NewElementProperty = DataBindingDragDropAddTriggerHandler.CommandProperty; } } else if (ProjectNeutralTypes.CallMethodAction.IsAssignableFrom((ITypeId)this.DragModel.TargetNode.Type) && this.DragModel.RelativeDropSchemaPath.IsMethod) { this.DragModel.DropFlags = DataBindingDragDropFlags.SetBinding; this.DragModel.TargetProperty = this.ProjectContext.ResolveProperty(DataBindingDragDropAddTriggerHandler.MethodNameProperty); } else if (ProjectNeutralTypes.InvokeCommandAction.IsAssignableFrom((ITypeId)this.DragModel.TargetNode.Type) && !this.DragModel.RelativeDropSchemaPath.IsMethod) { this.DragModel.DropFlags = DataBindingDragDropFlags.SetBinding; this.DragModel.TargetProperty = this.ProjectContext.ResolveProperty(DataBindingDragDropAddTriggerHandler.CommandProperty); } this.UpdateTooltip(); return(true); }
public static List <MethodInfo> GetSupportedMethods(ITypeResolver typeResolver, Type type) { List <MethodInfo> list = new List <MethodInfo>(); if (!DataBindingDragDropAddTriggerHandler.IsEnabled(typeResolver)) { return(list); } StringComparison comparison = DataBindingDragDropAddTriggerHandler.GetMethodNameComparison(typeResolver); foreach (MethodInfo methodInfo in DesignTypeGenerator.GetCommandMethods(type, typeResolver.PlatformMetadata, true)) { MethodInfo method = methodInfo; object[] customAttributes = method.GetCustomAttributes(typeof(BrowsableAttribute), true); if ((customAttributes.Length <= 0 || ((BrowsableAttribute)customAttributes[0]).Browsable) && list.FindIndex((Predicate <MethodInfo>)(m => string.Compare(method.Name, m.Name, comparison) == 0)) < 0) { list.Add(method); } } return(list); }