Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Messaging / System / Messaging / Design / QueuePathEditor.cs / 1305376 / QueuePathEditor.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Messaging.Design { using System; using System.Drawing; using System.Drawing.Design; using System.Windows.Forms; using System.Windows.Forms.ComponentModel; using System.Windows.Forms.Design; using System.ComponentModel; using System.ComponentModel.Design; using System.Messaging; ////// /// // permissions demanded by parent class [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] public class QueuePathEditor : UITypeEditor { ///[To be supplied.] ////// /// Edits the given object value using the editor style provided by /// GetEditorStyle. A service provider is provided so that any /// required editing services can be obtained. /// public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { QueuePathDialog dialog = new QueuePathDialog(provider); MessageQueue queue = null; if (value is MessageQueue) queue = (MessageQueue)value; else if (value is string) queue = new MessageQueue((string)value); else if (value != null) return value; if (queue != null) dialog.SelectQueue(queue); IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost)); DesignerTransaction trans = null; if (host != null) trans = host.CreateTransaction(); try { if ((context == null || context.OnComponentChanging()) && edSvc.ShowDialog(dialog) == DialogResult.OK) { if (dialog.Path != String.Empty) { if (context.Instance is MessageQueue || context.Instance is MessageQueueInstaller) value = dialog.Path; else { value = MessageQueueConverter.GetFromCache(dialog.Path); if (value == null) { value = new MessageQueue(dialog.Path); MessageQueueConverter.AddToCache((MessageQueue)value); if (context != null) context.Container.Add((IComponent)value); } } context.OnComponentChanged(); } } } finally { if (trans != null) { trans.Commit(); } } } } return value; } ////// /// Retrieves the editing style of the Edit method. If the method /// is not supported, this will return None. /// public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.Modal; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Messaging.Design { using System; using System.Drawing; using System.Drawing.Design; using System.Windows.Forms; using System.Windows.Forms.ComponentModel; using System.Windows.Forms.Design; using System.ComponentModel; using System.ComponentModel.Design; using System.Messaging; ////// /// // permissions demanded by parent class [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] public class QueuePathEditor : UITypeEditor { ///[To be supplied.] ////// /// Edits the given object value using the editor style provided by /// GetEditorStyle. A service provider is provided so that any /// required editing services can be obtained. /// public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { QueuePathDialog dialog = new QueuePathDialog(provider); MessageQueue queue = null; if (value is MessageQueue) queue = (MessageQueue)value; else if (value is string) queue = new MessageQueue((string)value); else if (value != null) return value; if (queue != null) dialog.SelectQueue(queue); IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost)); DesignerTransaction trans = null; if (host != null) trans = host.CreateTransaction(); try { if ((context == null || context.OnComponentChanging()) && edSvc.ShowDialog(dialog) == DialogResult.OK) { if (dialog.Path != String.Empty) { if (context.Instance is MessageQueue || context.Instance is MessageQueueInstaller) value = dialog.Path; else { value = MessageQueueConverter.GetFromCache(dialog.Path); if (value == null) { value = new MessageQueue(dialog.Path); MessageQueueConverter.AddToCache((MessageQueue)value); if (context != null) context.Container.Add((IComponent)value); } } context.OnComponentChanged(); } } } finally { if (trans != null) { trans.Commit(); } } } } return value; } ////// /// Retrieves the editing style of the Edit method. If the method /// is not supported, this will return None. /// public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.Modal; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UniqueIdentifierService.cs
- StylusEditingBehavior.cs
- ArrayElementGridEntry.cs
- ColorKeyFrameCollection.cs
- OracleBFile.cs
- CodeDomSerializer.cs
- RectAnimation.cs
- ConnectionsZoneAutoFormat.cs
- Dictionary.cs
- Model3DGroup.cs
- SystemDropShadowChrome.cs
- CertificateElement.cs
- ListViewInsertEventArgs.cs
- StyleReferenceConverter.cs
- OneWayChannelFactory.cs
- DataGridDetailsPresenter.cs
- SoapCodeExporter.cs
- PreviewPageInfo.cs
- CodePrimitiveExpression.cs
- TagPrefixInfo.cs
- IteratorDescriptor.cs
- GridViewSelectEventArgs.cs
- WindowsIdentity.cs
- GridViewColumnHeader.cs
- SignatureDescription.cs
- XhtmlTextWriter.cs
- AppSecurityManager.cs
- TreeViewImageIndexConverter.cs
- GotoExpression.cs
- SoapTypeAttribute.cs
- DrawListViewSubItemEventArgs.cs
- UIHelper.cs
- DrawingBrush.cs
- StopStoryboard.cs
- DbExpressionVisitor_TResultType.cs
- StateMachineSubscriptionManager.cs
- Style.cs
- IDataContractSurrogate.cs
- XPathSelfQuery.cs
- GPPOINT.cs
- DataServiceClientException.cs
- DbProviderSpecificTypePropertyAttribute.cs
- CustomErrorCollection.cs
- Crc32Helper.cs
- ConfigurationLockCollection.cs
- Geometry3D.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- AnonymousIdentificationModule.cs
- METAHEADER.cs
- SHA1CryptoServiceProvider.cs
- IMembershipProvider.cs
- StreamInfo.cs
- ToolStripButton.cs
- NegatedConstant.cs
- ClientRequest.cs
- ClientScriptManagerWrapper.cs
- Timeline.cs
- GridItemCollection.cs
- XDRSchema.cs
- UInt32Converter.cs
- DecoderFallbackWithFailureFlag.cs
- PageBorderless.cs
- ProviderConnectionPoint.cs
- WindowsListViewItemCheckBox.cs
- LogicalExpressionEditor.cs
- EntityExpressionVisitor.cs
- ping.cs
- EntryIndex.cs
- NetMsmqSecurityElement.cs
- CounterCreationData.cs
- WebHostScriptMappingsInstallComponent.cs
- Helpers.cs
- XPathException.cs
- SystemParameters.cs
- DataContractAttribute.cs
- UIPropertyMetadata.cs
- PathGeometry.cs
- RangeValidator.cs
- IntranetCredentialPolicy.cs
- PointKeyFrameCollection.cs
- MinimizableAttributeTypeConverter.cs
- CompositeFontInfo.cs
- ImageSource.cs
- StateMachineWorkflowDesigner.cs
- Trustee.cs
- TextRunCache.cs
- XamlClipboardData.cs
- CapabilitiesState.cs
- Adorner.cs
- FloatUtil.cs
- ApplicationFileCodeDomTreeGenerator.cs
- PixelShader.cs
- DataTableMappingCollection.cs
- Rectangle.cs
- ManagedWndProcTracker.cs
- RoleService.cs
- ModuleConfigurationInfo.cs
- X509Utils.cs
- _UriSyntax.cs
- XDeferredAxisSource.cs