Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Base / Core / PropertyEditing / PropertyFilter.cs / 1305376 / PropertyFilter.cs
namespace System.Activities.Presentation.PropertyEditing { using System; using System.Collections.Generic; using System.Runtime; using System.Activities.Presentation; ////// This class is used as part of the searching/filtering functionality that may provided /// by the property editing host. It contains a list of predicates (i.e. strings to match against) /// [Fx.Tag.XamlVisible(false)] public class PropertyFilter { private List_predicates = new List (); /// /// Creates a PropertyFilter. /// /// String representation of predicates, space delimited public PropertyFilter(string filterText) { SetPredicates(filterText); } ////// Creates a PropertyFilter. /// /// IEnumerable collection of predicates public PropertyFilter(IEnumerablepredicates) { SetPredicates(predicates); } /// /// Readonly property that returns true if this PropertyFilter does not have any predicates /// public bool IsEmpty { get { return this._predicates == null || this._predicates.Count == 0; } } private void SetPredicates(string filterText) { if (string.IsNullOrEmpty(filterText)) return; string[] filterParts = filterText.Split(' '); for (int i=0; i < filterParts.Length; i++) { if (!string.IsNullOrEmpty(filterParts[i])) { _predicates.Add(new PropertyFilterPredicate(filterParts[i])); } } } private void SetPredicates(IEnumerablepredicates) { if (predicates == null) return; foreach (PropertyFilterPredicate predicate in predicates) { if (predicate != null) { _predicates.Add(predicate); } } } /// /// Matches this filter against a particular filter target. The /// filter returns true if there are no predicates or if one or more /// predicates match the filter target. /// /// Target to attempt matching ///True if there are no predicates or if one or more /// predicates match the filter target, false otherwise ///If target is null. public bool Match(IPropertyFilterTarget target) { if (target == null) throw FxTrace.Exception.ArgumentNull("target"); if (this.IsEmpty) return true; // Perform an OR over all predicates for (int i = 0; i < this._predicates.Count; i++) { if (target.MatchesPredicate(_predicates[i])) return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpStreamXmlDictionaryWriter.cs
- DomNameTable.cs
- X509Certificate2.cs
- ProjectionCamera.cs
- RawMouseInputReport.cs
- NavigationExpr.cs
- InstanceOwner.cs
- SpotLight.cs
- CodeTypeReference.cs
- WindowsListViewItem.cs
- KnownAssemblyEntry.cs
- AppDomainUnloadedException.cs
- FacetEnabledSchemaElement.cs
- EditorPart.cs
- RangeBase.cs
- IncrementalHitTester.cs
- ExpressionBinding.cs
- ConnectionStringsExpressionBuilder.cs
- TraceSection.cs
- CreateUserErrorEventArgs.cs
- SpellerInterop.cs
- PolyLineSegment.cs
- EventDrivenDesigner.cs
- WebHeaderCollection.cs
- WSMessageEncoding.cs
- Rijndael.cs
- FactoryGenerator.cs
- NetDispatcherFaultException.cs
- HostedTransportConfigurationManager.cs
- WebPartCatalogAddVerb.cs
- PartManifestEntry.cs
- BamlReader.cs
- FrameworkEventSource.cs
- DependencyPropertyAttribute.cs
- ServicesUtilities.cs
- ClassDataContract.cs
- InstanceLockLostException.cs
- ToolStripControlHost.cs
- DataGridView.cs
- XpsFixedDocumentReaderWriter.cs
- DockingAttribute.cs
- IconEditor.cs
- SyntaxCheck.cs
- SqlMetaData.cs
- ParallelTimeline.cs
- ProcessModuleCollection.cs
- ExpressionVisitor.cs
- FtpCachePolicyElement.cs
- CodeVariableDeclarationStatement.cs
- EntityEntry.cs
- TabControlCancelEvent.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- SequentialUshortCollection.cs
- MetabaseServerConfig.cs
- MultipartContentParser.cs
- WCFServiceClientProxyGenerator.cs
- SeekableReadStream.cs
- ProxyGenerationError.cs
- HtmlTextArea.cs
- CreationContext.cs
- Cursors.cs
- XamlReaderHelper.cs
- MouseActionConverter.cs
- ComponentSerializationService.cs
- SourceChangedEventArgs.cs
- FontWeight.cs
- ValidateNames.cs
- NullRuntimeConfig.cs
- BamlLocalizationDictionary.cs
- TraceSection.cs
- DataGridViewCellPaintingEventArgs.cs
- SmiEventSink_DeferedProcessing.cs
- TypeConverterHelper.cs
- SHA384.cs
- LineInfo.cs
- BindingNavigator.cs
- Utils.cs
- SQLGuid.cs
- LabelLiteral.cs
- BadImageFormatException.cs
- Endpoint.cs
- EdmType.cs
- ConfigurationLocation.cs
- DataBindEngine.cs
- RankException.cs
- Dump.cs
- Variant.cs
- NamespaceImport.cs
- EncodingTable.cs
- mansign.cs
- DetailsViewAutoFormat.cs
- Socket.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- RequestBringIntoViewEventArgs.cs
- BigInt.cs
- CodeLabeledStatement.cs
- ListViewGroupItemCollection.cs
- DefaultValueConverter.cs
- MsdtcClusterUtils.cs
- ByValueEqualityComparer.cs