Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / Host / TypeDescriptorFilterService.cs / 1 / TypeDescriptorFilterService.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel.Design {
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
///
/// This service is requested by TypeDescriptor when asking for type information
/// for a component. Our implementation forwards this filter onto IDesignerFilter
/// on the component's designer, should one exist.
///
internal sealed class TypeDescriptorFilterService : ITypeDescriptorFilterService {
///
/// Internal ctor to prevent semitrust from creating us.
///
internal TypeDescriptorFilterService() {
}
///
/// Helper method to return the designer for a given component.
///
private IDesigner GetDesigner(IComponent component) {
ISite site = component.Site;
if (site != null) {
IDesignerHost host = site.GetService(typeof(IDesignerHost)) as IDesignerHost;
if (host != null) {
return host.GetDesigner(component);
}
}
return null;
}
///
///
/// Provides a way to filter the attributes from a component that are displayed to the user.
///
///
bool ITypeDescriptorFilterService.FilterAttributes(IComponent component, IDictionary attributes) {
if (component == null) {
throw new ArgumentNullException("component");
}
if (attributes == null) {
throw new ArgumentNullException("attributes");
}
IDesigner designer = GetDesigner(component);
if (designer is IDesignerFilter) {
((IDesignerFilter)designer).PreFilterAttributes(attributes);
((IDesignerFilter)designer).PostFilterAttributes(attributes);
}
return designer != null;
}
///
///
/// Provides a way to filter the events from a component that are displayed to the user.
///
///
bool ITypeDescriptorFilterService.FilterEvents(IComponent component, IDictionary events) {
if (component == null) {
throw new ArgumentNullException("component");
}
if (events == null) {
throw new ArgumentNullException("events");
}
IDesigner designer = GetDesigner(component);
if (designer is IDesignerFilter) {
((IDesignerFilter)designer).PreFilterEvents(events);
((IDesignerFilter)designer).PostFilterEvents(events);
}
return designer != null;
}
///
///
/// Provides a way to filter the properties from a component that are displayed to the user.
///
///
bool ITypeDescriptorFilterService.FilterProperties(IComponent component, IDictionary properties) {
if (component == null) {
throw new ArgumentNullException("component");
}
if (properties == null) {
throw new ArgumentNullException("properties");
}
IDesigner designer = GetDesigner(component);
if (designer is IDesignerFilter) {
((IDesignerFilter)designer).PreFilterProperties(properties);
((IDesignerFilter)designer).PostFilterProperties(properties);
}
return designer != null;
}
}
}
// 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
- ProcessHostConfigUtils.cs
- InternalTypeHelper.cs
- InheritedPropertyChangedEventArgs.cs
- Int64.cs
- ChineseLunisolarCalendar.cs
- SystemTcpStatistics.cs
- HtmlWindowCollection.cs
- CallTemplateAction.cs
- ThreadAttributes.cs
- TrustManagerMoreInformation.cs
- WebPartActionVerb.cs
- LinqDataSourceContextEventArgs.cs
- ConcatQueryOperator.cs
- ToolStripDropDown.cs
- SafeArrayRankMismatchException.cs
- WindowInteractionStateTracker.cs
- CellIdBoolean.cs
- ControlUtil.cs
- SourceLocationProvider.cs
- PropertyInformationCollection.cs
- QueryableDataSourceEditData.cs
- EncoderFallback.cs
- CodeStatementCollection.cs
- ImportRequest.cs
- FormViewModeEventArgs.cs
- SqlFacetAttribute.cs
- StrongNamePublicKeyBlob.cs
- XPathConvert.cs
- FixedSOMPageElement.cs
- FailedToStartupUIException.cs
- SecurityUtils.cs
- AsnEncodedData.cs
- DocumentOrderQuery.cs
- ContainerControl.cs
- SerializationStore.cs
- ValidationSummary.cs
- AuthenticatedStream.cs
- ControlBindingsCollection.cs
- _ScatterGatherBuffers.cs
- SerTrace.cs
- Crypto.cs
- ControlParser.cs
- IndicCharClassifier.cs
- XmlSchemaImporter.cs
- ToolBarButton.cs
- RequestCacheManager.cs
- ApplicationInfo.cs
- LinearGradientBrush.cs
- ClipboardProcessor.cs
- CodeObjectCreateExpression.cs
- HtmlTableRow.cs
- TimerEventSubscription.cs
- AnimatedTypeHelpers.cs
- ExceptionTrace.cs
- SafeNativeMethods.cs
- DispatchChannelSink.cs
- TcpServerChannel.cs
- PixelFormat.cs
- GenericTypeParameterBuilder.cs
- ArraySubsetEnumerator.cs
- SchemaCollectionPreprocessor.cs
- ADConnectionHelper.cs
- RoutedEventArgs.cs
- NativeCppClassAttribute.cs
- Literal.cs
- RootBrowserWindowProxy.cs
- Matrix3DConverter.cs
- CompilerState.cs
- EncoderParameter.cs
- FrameSecurityDescriptor.cs
- GetWinFXPath.cs
- ProfileSettingsCollection.cs
- CreateParams.cs
- OdbcCommandBuilder.cs
- RegisteredHiddenField.cs
- RotateTransform3D.cs
- TimeSpanMinutesConverter.cs
- RegexTree.cs
- TimeoutException.cs
- ServiceModelConfigurationSectionCollection.cs
- FreezableCollection.cs
- versioninfo.cs
- ListChangedEventArgs.cs
- RegexCompilationInfo.cs
- PipeStream.cs
- XmlChildEnumerator.cs
- Config.cs
- PolicyManager.cs
- DbTypeMap.cs
- PeerPresenceInfo.cs
- TreeNodeCollection.cs
- InvalidCastException.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- SettingsContext.cs
- SynchronizationContextHelper.cs
- EnumConverter.cs
- ImageListImageEditor.cs
- PersistenceTypeAttribute.cs
- QuaternionValueSerializer.cs
- SID.cs