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
- QueryTask.cs
- XPathException.cs
- ColorTransform.cs
- Int64Storage.cs
- Brush.cs
- CompilerError.cs
- GeometryHitTestParameters.cs
- ScrollEvent.cs
- FlowDocumentFormatter.cs
- DynamicMethod.cs
- WCFServiceClientProxyGenerator.cs
- PropertyGridView.cs
- DataGridItemEventArgs.cs
- DataControlCommands.cs
- sortedlist.cs
- BindingsCollection.cs
- XmlResolver.cs
- returneventsaver.cs
- HandlerWithFactory.cs
- LicenseProviderAttribute.cs
- COSERVERINFO.cs
- ComponentChangedEvent.cs
- RangeValuePattern.cs
- CompoundFileDeflateTransform.cs
- HttpPostedFileBase.cs
- InputScopeNameConverter.cs
- ToolStripPanelRow.cs
- ShapingWorkspace.cs
- wmiprovider.cs
- Geometry3D.cs
- PolicyLevel.cs
- _CacheStreams.cs
- CqlBlock.cs
- VisualStyleInformation.cs
- ExpressionEditorSheet.cs
- Certificate.cs
- Error.cs
- CodePageEncoding.cs
- MeasurementDCInfo.cs
- TagMapCollection.cs
- RowBinding.cs
- CallContext.cs
- UInt32Storage.cs
- FormViewActionList.cs
- CodeAttributeArgument.cs
- TemplateControl.cs
- EventPrivateKey.cs
- CallbackValidatorAttribute.cs
- SymLanguageVendor.cs
- ValidationVisibilityAttribute.cs
- WarningException.cs
- DispatchOperationRuntime.cs
- PackagingUtilities.cs
- EntityDataSourceEntityTypeFilterItem.cs
- InputQueueChannelAcceptor.cs
- XamlStream.cs
- CopyCodeAction.cs
- CreateSequence.cs
- CheckableControlBaseAdapter.cs
- OperatingSystem.cs
- CssStyleCollection.cs
- ParserExtension.cs
- SqlUdtInfo.cs
- RunClient.cs
- BamlLocalizableResource.cs
- MimeMultiPart.cs
- SqlUtils.cs
- TileBrush.cs
- _SslState.cs
- PixelFormats.cs
- HttpWriter.cs
- GetCryptoTransformRequest.cs
- ToolStripGripRenderEventArgs.cs
- DefaultValueAttribute.cs
- CapacityStreamGeometryContext.cs
- XmlSecureResolver.cs
- NumberFormatter.cs
- RegexTypeEditor.cs
- PrintPreviewGraphics.cs
- CollectionBuilder.cs
- XPathDescendantIterator.cs
- XmlRawWriter.cs
- DecimalAnimationBase.cs
- BindingEntityInfo.cs
- TextEditor.cs
- HttpRawResponse.cs
- DBAsyncResult.cs
- TabletDeviceInfo.cs
- SmtpDigestAuthenticationModule.cs
- WebControlParameterProxy.cs
- DescendantBaseQuery.cs
- InvalidCommandTreeException.cs
- SchemaNames.cs
- Codec.cs
- _CacheStreams.cs
- ImmutablePropertyDescriptorGridEntry.cs
- BaseConfigurationRecord.cs
- GenericRootAutomationPeer.cs
- FixedSOMSemanticBox.cs
- NavigationProperty.cs