Code:
/ 4.0 / 4.0 / 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. 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
- WebDisplayNameAttribute.cs
- AutomationPropertyInfo.cs
- AnimationClockResource.cs
- ValidationService.cs
- MonthCalendar.cs
- SafeRightsManagementQueryHandle.cs
- OpenFileDialog.cs
- SoapAttributes.cs
- Authorization.cs
- XmlSchemaType.cs
- DataGridViewSelectedCellCollection.cs
- TokenizerHelper.cs
- AsymmetricCryptoHandle.cs
- dtdvalidator.cs
- XmlQualifiedNameTest.cs
- KeysConverter.cs
- SpellCheck.cs
- SafeSecurityHandles.cs
- ByteAnimation.cs
- ProtocolElement.cs
- ExpressionLexer.cs
- Adorner.cs
- PolicyFactory.cs
- CodeIterationStatement.cs
- CacheMode.cs
- PartialArray.cs
- RequestCacheEntry.cs
- AutomationAttributeInfo.cs
- KoreanCalendar.cs
- Blend.cs
- UrlMappingsSection.cs
- XmlCharType.cs
- SQlBooleanStorage.cs
- Codec.cs
- RoutedPropertyChangedEventArgs.cs
- CollectionChange.cs
- StringAnimationUsingKeyFrames.cs
- IncrementalCompileAnalyzer.cs
- HttpAsyncResult.cs
- XmlSerializerNamespaces.cs
- NullableFloatMinMaxAggregationOperator.cs
- IPGlobalProperties.cs
- XmlDigitalSignatureProcessor.cs
- CompensatableSequenceActivity.cs
- UDPClient.cs
- CollectionViewGroupInternal.cs
- CancellationScope.cs
- TableLayoutCellPaintEventArgs.cs
- HttpConfigurationSystem.cs
- RegexFCD.cs
- ServiceNotStartedException.cs
- StringFreezingAttribute.cs
- WinEventHandler.cs
- CodeCommentStatementCollection.cs
- VisualProxy.cs
- GenericUriParser.cs
- TextEditorLists.cs
- SqlCommandSet.cs
- ProfileSettingsCollection.cs
- ToolStripContainer.cs
- XamlFigureLengthSerializer.cs
- SourceFilter.cs
- JavascriptCallbackMessageInspector.cs
- GeometryModel3D.cs
- ReadWriteSpinLock.cs
- TreeWalker.cs
- Transform.cs
- AffineTransform3D.cs
- NumberFormatInfo.cs
- TypedReference.cs
- DataGridLinkButton.cs
- Internal.cs
- OutputChannelBinder.cs
- XmlSchemaGroup.cs
- Component.cs
- PageBuildProvider.cs
- ConfigurationErrorsException.cs
- OracleString.cs
- oledbmetadatacollectionnames.cs
- PropertyEntry.cs
- QilPatternFactory.cs
- PixelFormats.cs
- WindowsFont.cs
- DataPagerCommandEventArgs.cs
- CryptoConfig.cs
- ScrollBarAutomationPeer.cs
- ClientFormsIdentity.cs
- Identity.cs
- StdValidatorsAndConverters.cs
- DefaultValueTypeConverter.cs
- ApplicationActivator.cs
- XslAstAnalyzer.cs
- LineVisual.cs
- GeneratedContractType.cs
- Rect3DValueSerializer.cs
- DataTemplate.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- CatalogPartChrome.cs
- CanonicalFormWriter.cs
- ExpressionBuilder.cs