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
- SessionStateUtil.cs
- Cloud.cs
- InputScopeManager.cs
- DragEventArgs.cs
- UnsafeNativeMethods.cs
- MinimizableAttributeTypeConverter.cs
- XmlProcessingInstruction.cs
- TimeSpanStorage.cs
- Typeface.cs
- ClientTargetCollection.cs
- SQLUtility.cs
- RemotingException.cs
- ConnectionPointCookie.cs
- NativeWindow.cs
- DataColumnMapping.cs
- AlternateViewCollection.cs
- StreamUpdate.cs
- HttpHeaderCollection.cs
- XmlRootAttribute.cs
- HwndProxyElementProvider.cs
- NumberSubstitution.cs
- FormViewUpdateEventArgs.cs
- BindingExpressionUncommonField.cs
- Internal.cs
- Parser.cs
- WindowsTab.cs
- WebPartCloseVerb.cs
- HtmlImage.cs
- WebHostScriptMappingsInstallComponent.cs
- DbProviderFactoriesConfigurationHandler.cs
- PackWebRequest.cs
- FlowDocument.cs
- WebUtil.cs
- ModelItemImpl.cs
- DataTableExtensions.cs
- XmlSerializationWriter.cs
- EdmEntityTypeAttribute.cs
- Viewport3DAutomationPeer.cs
- PersonalizableAttribute.cs
- BuildDependencySet.cs
- RectIndependentAnimationStorage.cs
- xmlglyphRunInfo.cs
- ImportContext.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- CompilerCollection.cs
- PeerCollaborationPermission.cs
- ObjectIDGenerator.cs
- DurableRuntimeValidator.cs
- DependencyPropertyChangedEventArgs.cs
- IsolatedStorageException.cs
- CachedTypeface.cs
- ImportOptions.cs
- ToolStripOverflow.cs
- CollectionViewGroupRoot.cs
- PartitionResolver.cs
- ColumnWidthChangingEvent.cs
- ArraySet.cs
- WebPartChrome.cs
- ErrorStyle.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- CreateUserErrorEventArgs.cs
- PrivateFontCollection.cs
- FlowDocument.cs
- PopOutPanel.cs
- PairComparer.cs
- PopupControlService.cs
- WindowsRegion.cs
- IdentitySection.cs
- HttpConfigurationSystem.cs
- ToolStripPanelRow.cs
- HostingEnvironmentSection.cs
- DesignerActionItemCollection.cs
- StorageEntitySetMapping.cs
- ConfigurationSectionGroupCollection.cs
- DataError.cs
- UserPersonalizationStateInfo.cs
- ClientOptions.cs
- FontClient.cs
- DataTrigger.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ControlBuilderAttribute.cs
- RegexFCD.cs
- DesignerCategoryAttribute.cs
- InternalBufferOverflowException.cs
- TextElementAutomationPeer.cs
- DataGridViewSortCompareEventArgs.cs
- SqlLiftIndependentRowExpressions.cs
- HelpInfo.cs
- ConfigXmlCDataSection.cs
- WebPartCatalogCloseVerb.cs
- StoragePropertyMapping.cs
- SecurityDescriptor.cs
- GAC.cs
- RowType.cs
- DataBindingHandlerAttribute.cs
- FontWeight.cs
- ViewStateModeByIdAttribute.cs
- RelationshipNavigation.cs
- SymbolEqualComparer.cs
- PropertyMapper.cs