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
- PropertyValidationContext.cs
- PingOptions.cs
- Geometry.cs
- QueryGenerator.cs
- oledbmetadatacollectionnames.cs
- AdditionalEntityFunctions.cs
- AppDomain.cs
- HttpHeaderCollection.cs
- OutputCacheSection.cs
- DataGridColumnEventArgs.cs
- XsltContext.cs
- DocumentStatusResources.cs
- SecurityProtocolFactory.cs
- SelectionPattern.cs
- ExpandCollapseProviderWrapper.cs
- ThrowHelper.cs
- MethodToken.cs
- WindowsScroll.cs
- SHA384.cs
- ValidationUtility.cs
- PointHitTestParameters.cs
- ViewStateModeByIdAttribute.cs
- PresentationAppDomainManager.cs
- XmlWhitespace.cs
- TrackingStringDictionary.cs
- EmbeddedMailObject.cs
- UIServiceHelper.cs
- QilInvokeLateBound.cs
- DefaultPrintController.cs
- InfoCardSymmetricCrypto.cs
- ListenerChannelContext.cs
- EntityDataSourceReferenceGroup.cs
- TrackPointCollection.cs
- XPathEmptyIterator.cs
- DATA_BLOB.cs
- X509CertificateCollection.cs
- NamedPipeProcessProtocolHandler.cs
- JsonStringDataContract.cs
- SecurityKeyType.cs
- RangeContentEnumerator.cs
- MapPathBasedVirtualPathProvider.cs
- WebEventCodes.cs
- SmiGettersStream.cs
- XmlResolver.cs
- InputQueue.cs
- DispatcherFrame.cs
- DataRelationPropertyDescriptor.cs
- ListControlActionList.cs
- ArraySubsetEnumerator.cs
- MutexSecurity.cs
- UrlMappingsModule.cs
- FamilyMap.cs
- NetworkInformationPermission.cs
- RTTypeWrapper.cs
- TextOnlyOutput.cs
- DispatcherExceptionFilterEventArgs.cs
- EntityStoreSchemaGenerator.cs
- DefaultMemberAttribute.cs
- RepeatButton.cs
- smtpconnection.cs
- TreeBuilder.cs
- ConfigurationSchemaErrors.cs
- VerticalConnector.xaml.cs
- AssemblyNameProxy.cs
- PathFigure.cs
- ListViewGroup.cs
- IndexedString.cs
- StateDesignerConnector.cs
- FormClosedEvent.cs
- DEREncoding.cs
- StylusPointCollection.cs
- DefaultMemberAttribute.cs
- IgnoreFlushAndCloseStream.cs
- SoapHeaders.cs
- RadioButton.cs
- PropertyGroupDescription.cs
- WeakReferenceList.cs
- ResourceBinder.cs
- SocketException.cs
- ProfileGroupSettingsCollection.cs
- WindowsPen.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- QuarticEase.cs
- Update.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- SqlBinder.cs
- StorageSetMapping.cs
- RequiredFieldValidator.cs
- PolicyStatement.cs
- TranslateTransform3D.cs
- XmlDataCollection.cs
- SimpleApplicationHost.cs
- ExpressionNormalizer.cs
- BoolExpression.cs
- FileInfo.cs
- EmissiveMaterial.cs
- SystemColors.cs
- PropertyToken.cs
- SequenceQuery.cs
- SecurityToken.cs