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
- HierarchicalDataSourceConverter.cs
- SamlSerializer.cs
- FormView.cs
- InternalSafeNativeMethods.cs
- SQLMembershipProvider.cs
- Mouse.cs
- PointAnimationUsingKeyFrames.cs
- COM2ColorConverter.cs
- SafeRightsManagementHandle.cs
- WS2007HttpBindingCollectionElement.cs
- PartitionedStreamMerger.cs
- CommonServiceBehaviorElement.cs
- WindowsFormsSynchronizationContext.cs
- NativeMethods.cs
- DrawingBrush.cs
- WebPartCatalogCloseVerb.cs
- QueryExpression.cs
- Point3DCollectionValueSerializer.cs
- SplashScreen.cs
- NewArrayExpression.cs
- SecurityHeader.cs
- AnnotationAdorner.cs
- ReflectionPermission.cs
- _ProxyChain.cs
- WebPartDesigner.cs
- TextSimpleMarkerProperties.cs
- ProcessModelInfo.cs
- Span.cs
- PTProvider.cs
- RoleManagerSection.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- MergePropertyDescriptor.cs
- GlobalAllocSafeHandle.cs
- processwaithandle.cs
- RepeatInfo.cs
- WindowsStatusBar.cs
- MatrixStack.cs
- AppManager.cs
- Psha1DerivedKeyGeneratorHelper.cs
- TextDecoration.cs
- baseaxisquery.cs
- MetaType.cs
- ReadOnlyCollection.cs
- QueryGeneratorBase.cs
- Component.cs
- RawMouseInputReport.cs
- ISAPIWorkerRequest.cs
- EditorReuseAttribute.cs
- StsCommunicationException.cs
- MediaCommands.cs
- MoveSizeWinEventHandler.cs
- CharConverter.cs
- UpdatePanelTriggerCollection.cs
- wpf-etw.cs
- View.cs
- ImageIndexEditor.cs
- ToolStripArrowRenderEventArgs.cs
- StorageEndPropertyMapping.cs
- MinimizableAttributeTypeConverter.cs
- BufferBuilder.cs
- DataGridViewToolTip.cs
- AddInAdapter.cs
- XmlNotation.cs
- clipboard.cs
- CompositeActivityMarkupSerializer.cs
- ValueQuery.cs
- storepermission.cs
- StylusPlugin.cs
- webeventbuffer.cs
- DirectoryObjectSecurity.cs
- RuleSettingsCollection.cs
- MultiAsyncResult.cs
- HtmlInputText.cs
- ExportOptions.cs
- SubqueryTrackingVisitor.cs
- PrimitiveXmlSerializers.cs
- DependencyPropertyAttribute.cs
- TextDecorations.cs
- Camera.cs
- SHA1CryptoServiceProvider.cs
- HttpProfileGroupBase.cs
- SessionStateSection.cs
- CodeSnippetTypeMember.cs
- SessionStateSection.cs
- XmlSchemaSimpleTypeList.cs
- smtppermission.cs
- ToolStripControlHost.cs
- SafeFindHandle.cs
- SrgsNameValueTag.cs
- HttpStreamMessageEncoderFactory.cs
- TextServicesDisplayAttribute.cs
- DateTimeFormatInfo.cs
- WindowsFont.cs
- Int32CollectionValueSerializer.cs
- GeometryCollection.cs
- XmlSerializerSection.cs
- CombinedGeometry.cs
- XamlPathDataSerializer.cs
- XmlSchemaComplexType.cs
- XmlMapping.cs