PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() { // get model properties List <PropertyDescriptor> properties = new List <PropertyDescriptor>(); foreach (PropertyDescriptor modelPropertyDescriptor in ModelUtilities.WrapProperties(this)) { properties.Add(modelPropertyDescriptor); } // try to see if there are pseudo builtin properties for this type. AttachedPropertiesService AttachedPropertiesService = this.modelTreeManager.Context.Services.GetService <AttachedPropertiesService>(); if (AttachedPropertiesService != null) { var nonBrowsableAttachedProperties = from attachedProperty in AttachedPropertiesService.GetAttachedProperties(this.itemType) where (!attachedProperty.IsBrowsable && !attachedProperty.IsVisibleToModelItem) select attachedProperty; foreach (AttachedProperty AttachedProperty in nonBrowsableAttachedProperties) { properties.Add(new AttachedPropertyDescriptor(AttachedProperty, this)); } } return(new PropertyDescriptorCollection(properties.ToArray(), true)); }
private ModelItem FindModelItemToFocus(ModelItem itemToFocus) { WorkflowViewService viewService = this.WorkflowViewService; if (viewService == null || itemToFocus == null) { return(itemToFocus); } ModelUtilities.ReverseTraverse(itemToFocus, (ModelItem modelItem) => { if (modelItem == null) { // continue; return(true); } // if the item has Designer, we assume it can get focus. if (CanFocusOnModelItem(modelItem, viewService)) { itemToFocus = modelItem; // break; return(false); } // continue return(true); }); return(itemToFocus); }
private static SearchableEntry CreateSearchableEntryForArgumentOrVariable(ModelItem itemToFocus) { SearchableEntry entry = null; ModelUtilities.ReverseTraverse(itemToFocus, (ModelItem modelItem) => { entry = CreateSearchableEntryNoRecursive(modelItem); return(entry == null); }); return(entry); }
internal static ModelItem ReverseFindFirst(ModelItem start, Predicate <ModelItem> matcher) { Fx.Assert(start != null, "start should not be null"); Fx.Assert(matcher != null, "matcher should not be null"); ModelItem result = null; ModelUtilities.ReverseTraverse(start, (ModelItem current) => { if (matcher(current)) { result = current; return(false); } return(true); }); return(result); }
internal IEnumerable <ModelItem> GetItemsOnDesigner(bool preOrder, bool excludeRoot, bool excludeErrorActivity, bool excludeExpression, bool includeOtherObjects) { WorkflowViewService viewService = this.WorkflowViewService; IList <ModelItem> items = ModelTreeManager.DepthFirstSearch(modelService.Root, delegate(Type type) { // Only find items on the designer surface. return(includeOtherObjects || (typeof(WorkflowViewElement).IsAssignableFrom(viewService.GetDesignerType(type)))); }, delegate(ModelItem modelItem) { return(!(excludeExpression && modelItem != null && typeof(ITextExpression).IsAssignableFrom(modelItem.ItemType))); }, preOrder); // ModelItemKeyValuePair is associated with CaseDesigner. // So ModelItemKeyValuePair will be returned even if they are not really Cases. // Those ModelItemKeyValuePairs need to be excluded. IEnumerable <ModelItem> itemsToSearch = null; if (!excludeErrorActivity) { itemsToSearch = items.Where <ModelItem>(item => !ModelUtilities.IsModelItemKeyValuePair(item.ItemType) || ModelUtilities.IsSwitchCase(item)); } else { itemsToSearch = items.Where <ModelItem>(item => (!ModelUtilities.IsModelItemKeyValuePair(item.ItemType) || ModelUtilities.IsSwitchCase(item)) && !IsErrorActivity(item)); } if (excludeRoot) { itemsToSearch = itemsToSearch.Except <ModelItem>(new ModelItem[] { modelService.Root }); } return(itemsToSearch); }
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { return(ModelUtilities.WrapProperties(this)); }
PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() { return(ModelUtilities.GetDefaultProperty(this)); }
TypeConverter ICustomTypeDescriptor.GetConverter() { return(ModelUtilities.GetConverter(this)); }