Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebControls / LocalizeDesigner.cs / 1 / LocalizeDesigner.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.WebControls { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Design; using System.Diagnostics; using System.Globalization; using System.Text; using System.Web.UI.Design; using System.Web.UI.WebControls; [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)] [SupportsPreviewControl(true)] internal class LocalizeDesigner : LiteralDesigner { private const string DesignTimeHtml = @""; public override string GetDesignTimeHtml(DesignerRegionCollection regions) { EditableDesignerRegion region = new EditableDesignerRegion(this, "Text"); region.Description = SR.GetString(SR.LocalizeDesigner_RegionWatermark); region.Properties[typeof(Control)] = Component; regions.Add(region); return String.Format(CultureInfo.InvariantCulture, DesignTimeHtml, DesignerRegion.DesignerRegionAttributeName); } public override string GetEditableDesignerRegionContent(EditableDesignerRegion region) { PropertyDescriptor propDesc = TypeDescriptor.GetProperties(Component)["Text"]; return (string)propDesc.GetValue(Component); } public override void SetEditableDesignerRegionContent(EditableDesignerRegion region, string content) { string text = content; try { IDesignerHost designerHost = (IDesignerHost)GetService(typeof(IDesignerHost)); Control[] controls = ControlParser.ParseControls(designerHost, content); text = String.Empty; foreach (Control c in controls) { LiteralControl literal = c as LiteralControl; if (literal != null) { text += literal.Text; } } } catch { // In the unlikely event that there is an error parsing controls from the // region content, we just end up using the raw content as the Text property. // It's highly unlikely to ever throw an exception since the tool just // persisted the content moments earlier. } PropertyDescriptor propDesc = TypeDescriptor.GetProperties(Component)["Text"]; propDesc.SetValue(Component, text); } protected override void PostFilterProperties(IDictionary properties) { // Hide all properties except for ID HideAllPropertiesExceptID(properties); base.PostFilterAttributes(properties); } } } // 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
- ModelItemCollection.cs
- WebPartConnectionsCancelVerb.cs
- precedingsibling.cs
- PermissionToken.cs
- NGCUIElementCollectionSerializerAsync.cs
- SolidBrush.cs
- XmlSchemaInclude.cs
- PropertyMapper.cs
- PageCodeDomTreeGenerator.cs
- ParameterCollection.cs
- DefaultTraceListener.cs
- SqlConnectionManager.cs
- CheckPair.cs
- AppSettingsReader.cs
- LogFlushAsyncResult.cs
- StringValidatorAttribute.cs
- AutoCompleteStringCollection.cs
- UserControlDesigner.cs
- WebPartCollection.cs
- _NegoStream.cs
- ProcessModelInfo.cs
- ResourcesGenerator.cs
- BidPrivateBase.cs
- DataGridViewCellConverter.cs
- SmtpFailedRecipientException.cs
- ThreadAbortException.cs
- OciEnlistContext.cs
- ShapingWorkspace.cs
- RoleManagerSection.cs
- XmlSchemaAttributeGroupRef.cs
- LocalizedNameDescriptionPair.cs
- CopyAttributesAction.cs
- ProtocolsConfigurationHandler.cs
- EnumerableWrapperWeakToStrong.cs
- XamlTemplateSerializer.cs
- CrossContextChannel.cs
- StylusPointCollection.cs
- NativeMethods.cs
- DataSysAttribute.cs
- RemotingException.cs
- _NegoStream.cs
- TransformBlockRequest.cs
- UInt16.cs
- ProxyWebPart.cs
- GlyphTypeface.cs
- IODescriptionAttribute.cs
- HttpException.cs
- NotifyIcon.cs
- EntityExpressionVisitor.cs
- CommandID.cs
- RbTree.cs
- ExpressionVisitorHelpers.cs
- GridViewCellAutomationPeer.cs
- PingOptions.cs
- HtmlObjectListAdapter.cs
- DefaultWorkflowTransactionService.cs
- RouteItem.cs
- ConfigurationValue.cs
- SoapCodeExporter.cs
- ResourcesChangeInfo.cs
- RequestCacheEntry.cs
- DelegatingConfigHost.cs
- PropertyDescriptorGridEntry.cs
- HtmlToClrEventProxy.cs
- Descriptor.cs
- PropertyBuilder.cs
- UnsafeNativeMethods.cs
- SplineKeyFrames.cs
- ActionItem.cs
- ToolboxComponentsCreatedEventArgs.cs
- MimeAnyImporter.cs
- GridViewRowEventArgs.cs
- UInt32Converter.cs
- VSWCFServiceContractGenerator.cs
- ReadWriteSpinLock.cs
- QilPatternFactory.cs
- Brush.cs
- TrackingMemoryStreamFactory.cs
- ContentWrapperAttribute.cs
- FocusWithinProperty.cs
- DataColumnMappingCollection.cs
- HtmlInputControl.cs
- SingleSelectRootGridEntry.cs
- ButtonAutomationPeer.cs
- HttpClientCertificate.cs
- GroupBox.cs
- MultipartIdentifier.cs
- QueryCacheManager.cs
- StatusStrip.cs
- SemanticValue.cs
- VariantWrapper.cs
- LocalizableAttribute.cs
- DesignerTransaction.cs
- TableAdapterManagerGenerator.cs
- ProtocolsConfiguration.cs
- NamedPipeHostedTransportConfiguration.cs
- safelinkcollection.cs
- RegexBoyerMoore.cs
- XmlWrappingReader.cs
- ListControlConvertEventArgs.cs