Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / CompMod / System / ComponentModel / Design / DesignerActionUIService.cs / 1 / DesignerActionUIService.cs
//#define DEBUGDESIGNERTASKS //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.ComponentModel.Design { using System; using System.Collections; using System.ComponentModel; using System.Timers; using System.Diagnostics.CodeAnalysis; using System.Diagnostics; ////// /// public sealed class DesignerActionUIService : IDisposable { private DesignerActionUIStateChangeEventHandler designerActionUIStateChangedEventHandler; private IServiceProvider serviceProvider;//standard service provider private DesignerActionService designerActionService; internal DesignerActionUIService(IServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; if (serviceProvider != null) { this.serviceProvider = serviceProvider; IDesignerHost host = (IDesignerHost)serviceProvider.GetService(typeof(IDesignerHost)); host.AddService(typeof(DesignerActionUIService), this); designerActionService = serviceProvider.GetService(typeof(DesignerActionService)) as DesignerActionService; Debug.Assert(designerActionService != null, "we should have created and registered the DAService first"); } } ////// /// Disposes all resources and unhooks all events. /// [SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed")] public void Dispose() { if (serviceProvider != null) { IDesignerHost host = (IDesignerHost)serviceProvider.GetService(typeof(IDesignerHost)); if (host != null) { host.RemoveService(typeof(DesignerActionUIService)); } } } ////// /// This event is thrown whenever a request is made to show/hide the ui /// public event DesignerActionUIStateChangeEventHandler DesignerActionUIStateChange { add { designerActionUIStateChangedEventHandler += value; } remove { designerActionUIStateChangedEventHandler -= value; } } public void HideUI(IComponent component) { OnDesignerActionUIStateChange(new DesignerActionUIStateChangeEventArgs(component, DesignerActionUIStateChangeType.Hide)); } public void ShowUI(IComponent component) { OnDesignerActionUIStateChange(new DesignerActionUIStateChangeEventArgs(component, DesignerActionUIStateChangeType.Show)); } ////// /// This is a new Helper Method that the service provides to refresh the DesignerActionGlyph as well as DesignerActionPanels. /// public void Refresh(IComponent component) { OnDesignerActionUIStateChange(new DesignerActionUIStateChangeEventArgs(component, DesignerActionUIStateChangeType.Refresh)); } ////// This fires our DesignerActionsChanged event. /// private void OnDesignerActionUIStateChange(DesignerActionUIStateChangeEventArgs e) { if (designerActionUIStateChangedEventHandler != null) { designerActionUIStateChangedEventHandler(this, e); } } public bool ShouldAutoShow(IComponent component) { // Check the designer options... if (serviceProvider != null) { DesignerOptionService opts = serviceProvider.GetService(typeof(DesignerOptionService)) as DesignerOptionService; if (opts != null) { PropertyDescriptor p = opts.Options.Properties["ObjectBoundSmartTagAutoShow"]; if (p != null && p.PropertyType == typeof(bool) && !(bool)p.GetValue(null)) { return false; } } } if(designerActionService != null) { DesignerActionListCollection coll = designerActionService.GetComponentActions(component); if(coll != null && coll.Count > 0) { for(int i = 0;i
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AsynchronousChannelMergeEnumerator.cs
- ReversePositionQuery.cs
- CodeSnippetTypeMember.cs
- QilGeneratorEnv.cs
- ToolStripSeparatorRenderEventArgs.cs
- UserControl.cs
- XmlStreamNodeWriter.cs
- Label.cs
- SecurityException.cs
- ChameleonKey.cs
- TextMessageEncodingBindingElement.cs
- BamlLocalizableResource.cs
- OuterGlowBitmapEffect.cs
- EnlistmentState.cs
- COM2ICategorizePropertiesHandler.cs
- Mutex.cs
- CrossSiteScriptingValidation.cs
- TypeResolvingOptionsAttribute.cs
- TextFormatterContext.cs
- CodeCommentStatementCollection.cs
- Serializer.cs
- StateMachineWorkflowDesigner.cs
- XmlDataImplementation.cs
- DataChangedEventManager.cs
- WsdlInspector.cs
- Matrix3D.cs
- SingleObjectCollection.cs
- XmlRootAttribute.cs
- SoapAttributeOverrides.cs
- SqlBuilder.cs
- AdCreatedEventArgs.cs
- IgnoreFlushAndCloseStream.cs
- ControlValuePropertyAttribute.cs
- MobileCategoryAttribute.cs
- ReachPageContentSerializerAsync.cs
- SpellCheck.cs
- SamlAttributeStatement.cs
- DropDownButton.cs
- SpecularMaterial.cs
- CrossSiteScriptingValidation.cs
- WebPartMinimizeVerb.cs
- CodeStatement.cs
- DataColumnMapping.cs
- GridViewPageEventArgs.cs
- PersistencePipeline.cs
- CatalogZoneBase.cs
- DiscreteKeyFrames.cs
- TagMapInfo.cs
- EventsTab.cs
- SqlServices.cs
- QilUnary.cs
- XamlWriter.cs
- PackageRelationshipSelector.cs
- Update.cs
- X509SubjectKeyIdentifierClause.cs
- Configuration.cs
- SqlFunctionAttribute.cs
- DefaultTraceListener.cs
- StylusCollection.cs
- ProcessHostFactoryHelper.cs
- BitmapDecoder.cs
- DataKey.cs
- DoubleLinkListEnumerator.cs
- AssociationSet.cs
- BypassElement.cs
- path.cs
- EntityKeyElement.cs
- BaseCollection.cs
- ToolStripStatusLabel.cs
- CssClassPropertyAttribute.cs
- FaultContractAttribute.cs
- AspCompat.cs
- DropSource.cs
- ContentElementCollection.cs
- TableItemStyle.cs
- WinHttpWebProxyFinder.cs
- SystemTcpConnection.cs
- InvokePattern.cs
- EntitySqlQueryState.cs
- FrameAutomationPeer.cs
- XslException.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- RelationshipNavigation.cs
- DataBindingExpressionBuilder.cs
- GeneralTransform.cs
- documentsequencetextpointer.cs
- SessionStateSection.cs
- Transform3DGroup.cs
- EntityDataSourceWizardForm.cs
- XmlWrappingReader.cs
- datacache.cs
- JavaScriptSerializer.cs
- PopOutPanel.cs
- QueueAccessMode.cs
- RelOps.cs
- XsdCachingReader.cs
- OdbcConnectionFactory.cs
- DateTimeParse.cs
- ComAdminInterfaces.cs
- LineVisual.cs