public NewTransformViewModel(TransformCollectionViewModel transforms, Window window) : base() { this.Commands.AddItem("Create", t => this.Create(window), t => this.CanCreate()); this.transformCollectionViewModel = transforms; this.TransformType = TypeMarkupExtension.GetSubclassDescriptors (typeof(Transform)).FirstOrDefault(t => !t.Value.GetCustomAttributes(true).Any ( u => u.GetType() == typeof(LoopbackTransformAttribute) ) ).Value; }
public override object ProvideValue(IServiceProvider serviceProvider) { TypeMarkupExtension typeExtension = new TypeMarkupExtension(typeof(Transform)); IEnumerable <TypeDescriptionWrapper> result = typeExtension.ProvideValue(null) as IEnumerable <TypeDescriptionWrapper>; if (result == null) { throw new ArgumentException("result"); } if (TransformGlobal.HostProcessSupportsLoopbackTransforms) { return(result); } else { return(result.Where(t => !(t.Value.GetCustomAttributes(true).Any(u => u.GetType() == typeof(LoopbackTransformAttribute))))); } }