Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / ndp / fx / src / xsp / System / Web / Extensions / ui / ScriptManagerProxy.cs / 1 / ScriptManagerProxy.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Drawing.Design; using System.Globalization; using System.Security.Permissions; using System.Web; using System.Web.UI; using System.Web.Resources; using System.Web.Util; [ AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), DefaultProperty("Scripts"), Designer("System.Web.UI.Design.ScriptManagerProxyDesigner, " + AssemblyRef.SystemWebExtensionsDesign), NonVisualControl(), ParseChildren(true), PersistChildren(false), ToolboxBitmap(typeof(EmbeddedResourceFinder), "System.Web.Resources.ScriptManagerProxy.bmp"), ] public class ScriptManagerProxy : Control, IControl { private IScriptManagerInternal _scriptManager; private ScriptReferenceCollection _scripts; private ServiceReferenceCollection _services; private ProfileServiceManager _profileServiceManager; private AuthenticationServiceManager _authenticationServiceManager; private RoleServiceManager _roleServiceManager; public ScriptManagerProxy() { } internal ScriptManagerProxy(IScriptManagerInternal scriptManager) { _scriptManager = scriptManager; } [ ResourceDescription("ScriptManager_AuthenticationService"), Category("Behavior"), DefaultValue(null), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.InnerProperty), MergableProperty(false), ] public AuthenticationServiceManager AuthenticationService { get { if(_authenticationServiceManager == null) { _authenticationServiceManager = new AuthenticationServiceManager(); } return _authenticationServiceManager; } } internal bool HasProfileServiceManager { get { return this._profileServiceManager != null; } } internal bool HasAuthenticationServiceManager { get { return this._authenticationServiceManager != null; } } internal bool HasRoleServiceManager { get { return this._roleServiceManager != null; } } [ ResourceDescription("ScriptManager_ProfileService"), Category("Behavior"), DefaultValue(null), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.InnerProperty), MergableProperty(false), ] public ProfileServiceManager ProfileService { get { if(_profileServiceManager == null) { _profileServiceManager = new ProfileServiceManager(); } return _profileServiceManager; } } [ ResourceDescription("ScriptManager_RoleService"), Category("Behavior"), DefaultValue(null), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.InnerProperty), MergableProperty(false), ] public RoleServiceManager RoleService { get { if(_roleServiceManager == null) { _roleServiceManager = new RoleServiceManager(); } return _roleServiceManager; } } private IScriptManagerInternal ScriptManager { get { if (_scriptManager == null) { Page page = Page; if (page == null) { throw new InvalidOperationException(AtlasWeb.Common_PageCannotBeNull); } _scriptManager = UI.ScriptManager.GetCurrent(Page); if (_scriptManager == null) { throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.Common_ScriptManagerRequired, ID)); } } return _scriptManager; } } [ ResourceDescription("ScriptManager_Scripts"), Category("Behavior"), DefaultValue(null), Editor("System.Web.UI.Design.CollectionEditorBase, " + AssemblyRef.SystemWebExtensionsDesign, typeof(UITypeEditor)), PersistenceMode(PersistenceMode.InnerProperty), MergableProperty(false), ] public ScriptReferenceCollection Scripts { get { if (_scripts == null) { _scripts = new ScriptReferenceCollection(); } return _scripts; } } [ ResourceDescription("ScriptManager_Services"), Category("Behavior"), DefaultValue(null), Editor("System.Web.UI.Design.CollectionEditorBase, " + AssemblyRef.SystemWebExtensionsDesign, typeof(UITypeEditor)), PersistenceMode(PersistenceMode.InnerProperty), MergableProperty(false), ] public ServiceReferenceCollection Services { get { if (_services == null) { _services = new ServiceReferenceCollection(); } return _services; } } [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never) ] public override bool Visible { get { return base.Visible; } set { throw new NotImplementedException(); } } internal void CollectScripts(Listscripts) { // PERF: Use field directly to avoid creating List if not already created if (_scripts != null) { foreach (ScriptReference scriptReference in _scripts) { scriptReference.ClientUrlResolver = this; scriptReference.ContainingControl = this; scriptReference.IsStaticReference = true; scripts.Add(scriptReference); } } } [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] protected internal override void OnInit(EventArgs e) { base.OnInit(e); if (!DesignMode) { ScriptManager.RegisterProxy(this); } } internal void RegisterServices(ScriptManager scriptManager) { // PERF: Use field directly to avoid creating List if not already created if (_services != null) { foreach (ServiceReference serviceReference in _services) { serviceReference.Register(this, Context, scriptManager, scriptManager.IsDebuggingEnabled); } } } #region IControl Members IHttpContext IControl.Context { get { return new HttpContextWrapper(Context); } } bool IControl.DesignMode { get { return DesignMode; } } #endregion } } // 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
- MetadataItemEmitter.cs
- CookieProtection.cs
- BasicKeyConstraint.cs
- TypeConverterHelper.cs
- ExpressionDumper.cs
- EventManager.cs
- UserControlCodeDomTreeGenerator.cs
- __ConsoleStream.cs
- ControlParameter.cs
- TextBoxLine.cs
- _SslSessionsCache.cs
- ConnectionPointCookie.cs
- DataGridHeaderBorder.cs
- StateDesigner.LayoutSelectionGlyph.cs
- Stackframe.cs
- OracleSqlParser.cs
- Vector3DCollection.cs
- DbConnectionPoolGroupProviderInfo.cs
- ConstraintConverter.cs
- PointValueSerializer.cs
- ApplicationActivator.cs
- HtmlEmptyTagControlBuilder.cs
- FormsIdentity.cs
- UiaCoreProviderApi.cs
- Utils.cs
- ObjRef.cs
- EntityDataSourceConfigureObjectContextPanel.cs
- CheckBoxStandardAdapter.cs
- StickyNoteAnnotations.cs
- PrivateFontCollection.cs
- SoapAttributes.cs
- MasterPage.cs
- LayoutEvent.cs
- StaticTextPointer.cs
- URLString.cs
- WindowsSecurityToken.cs
- Rfc2898DeriveBytes.cs
- File.cs
- ToolstripProfessionalRenderer.cs
- ModifierKeysValueSerializer.cs
- SID.cs
- BinaryMethodMessage.cs
- TextLineResult.cs
- ExpressionBindingCollection.cs
- TypeConstant.cs
- NonBatchDirectoryCompiler.cs
- Int32Rect.cs
- _AutoWebProxyScriptEngine.cs
- GeneralTransform3DCollection.cs
- DataSetMappper.cs
- Binding.cs
- WebReferenceOptions.cs
- _DigestClient.cs
- QilIterator.cs
- XamlStackWriter.cs
- PipelineDeploymentState.cs
- StateMachineHelpers.cs
- HybridDictionary.cs
- ClassValidator.cs
- ProfileGroupSettingsCollection.cs
- ArcSegment.cs
- ProfileService.cs
- BinaryUtilClasses.cs
- WebServiceParameterData.cs
- DesignRelationCollection.cs
- ComponentManagerBroker.cs
- ExpressionBindingCollection.cs
- CheckBox.cs
- MatrixValueSerializer.cs
- DataSourceSelectArguments.cs
- StylusShape.cs
- ButtonAutomationPeer.cs
- DesignerResources.cs
- BuildResultCache.cs
- PaperSize.cs
- RegistrationServices.cs
- CaseStatementSlot.cs
- WebPartHeaderCloseVerb.cs
- SoapEnvelopeProcessingElement.cs
- DbDataSourceEnumerator.cs
- SystemUdpStatistics.cs
- ColumnProvider.cs
- UserControl.cs
- CqlLexer.cs
- KnownTypesProvider.cs
- UriPrefixTable.cs
- SecurityProtocolFactory.cs
- Model3D.cs
- LinkButton.cs
- SiteMapPath.cs
- DrawingContextDrawingContextWalker.cs
- _FtpControlStream.cs
- SafeRightsManagementQueryHandle.cs
- PreviewPrintController.cs
- HttpRequest.cs
- SubordinateTransaction.cs
- SymLanguageVendor.cs
- _ProxyChain.cs
- TypeNameHelper.cs
- WebPartsSection.cs