Code:
/ FX-1434 / FX-1434 / 1.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
- DateBoldEvent.cs
- OdbcRowUpdatingEvent.cs
- DataGridAddNewRow.cs
- RepeaterItem.cs
- TypeSystem.cs
- MatrixConverter.cs
- WebPartDescriptionCollection.cs
- RegexMatchCollection.cs
- BrowserCapabilitiesFactory.cs
- SqlProfileProvider.cs
- TextContainerChangeEventArgs.cs
- Memoizer.cs
- ZipPackage.cs
- Token.cs
- ProxyWebPartManager.cs
- PrintPreviewControl.cs
- BCLDebug.cs
- CodeAccessSecurityEngine.cs
- ActivityDesignerResources.cs
- ProviderIncompatibleException.cs
- TextDecorationCollectionConverter.cs
- XmlSchemaSequence.cs
- ChildChangedEventArgs.cs
- RegisteredDisposeScript.cs
- EdgeModeValidation.cs
- XmlSchemaAnnotated.cs
- JoinTreeNode.cs
- BezierSegment.cs
- initElementDictionary.cs
- XsltLibrary.cs
- PasswordRecovery.cs
- ListDictionary.cs
- ControlsConfig.cs
- Vector3DAnimationBase.cs
- BypassElementCollection.cs
- DocumentReferenceCollection.cs
- DescendantQuery.cs
- SafeSecurityHelper.cs
- AttachedAnnotation.cs
- ToolStripDropDownItemDesigner.cs
- ListViewGroup.cs
- SymLanguageVendor.cs
- ServerValidateEventArgs.cs
- D3DImage.cs
- ListBoxItem.cs
- JsonObjectDataContract.cs
- ScopelessEnumAttribute.cs
- WebPartTracker.cs
- SafeReadContext.cs
- XmlChildEnumerator.cs
- TableParaClient.cs
- HttpCacheVaryByContentEncodings.cs
- FilterException.cs
- TableSectionStyle.cs
- Symbol.cs
- HtmlInputCheckBox.cs
- CodeMethodInvokeExpression.cs
- TagPrefixAttribute.cs
- BufferedGraphicsManager.cs
- MdiWindowListStrip.cs
- AesCryptoServiceProvider.cs
- ProgressBar.cs
- SerializationInfoEnumerator.cs
- SamlSecurityTokenAuthenticator.cs
- SQLDecimal.cs
- ListMarkerLine.cs
- BuildTopDownAttribute.cs
- DelegateSerializationHolder.cs
- Size.cs
- Shape.cs
- Point3DKeyFrameCollection.cs
- SafeLibraryHandle.cs
- HttpCacheParams.cs
- LineInfo.cs
- ResourceAssociationSetEnd.cs
- PageRanges.cs
- TextEditorThreadLocalStore.cs
- GridViewEditEventArgs.cs
- TraceHandler.cs
- XpsImageSerializationService.cs
- HtmlMobileTextWriter.cs
- UriSectionReader.cs
- DispatcherHooks.cs
- DataTableMappingCollection.cs
- ThreadPool.cs
- MetadataCacheItem.cs
- WinFormsComponentEditor.cs
- MbpInfo.cs
- WindowsTreeView.cs
- DataGridViewDataConnection.cs
- CaseStatement.cs
- FilterableAttribute.cs
- EventsTab.cs
- Behavior.cs
- LineUtil.cs
- ListControlBuilder.cs
- XslAstAnalyzer.cs
- CheckBoxList.cs
- GZipDecoder.cs
- ServerValidateEventArgs.cs