コード例 #1
0
        /// <summary>
        /// Gets the extension server for the specified extension server attribute.
        /// </summary>
        public ExtensionServer GetExtensionServer(ExtensionServerAttribute attribute)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException("attribute");
            }

            Type extensionServerType = attribute.ExtensionServerType;

            ExtensionServer server;

            if (_extensionServers.TryGetValue(extensionServerType, out server))
            {
                return(server);
            }

            server = (ExtensionServer)Activator.CreateInstance(extensionServerType);
            server.InitializeExtensionServer(_context);
            _extensionServers[extensionServerType]   = server;
            server.ShouldApplyExtensionsInvalidated += delegate(object sender, DesignItemCollectionEventArgs e) {
                ReapplyExtensions(e.Items, (ExtensionServer)sender);
            };
            return(server);
        }
コード例 #2
0
		/// <summary>
		/// Gets the extension server for the specified extension server attribute.
		/// </summary>
		public ExtensionServer GetExtensionServer(ExtensionServerAttribute attribute)
		{
			if (attribute == null)
				throw new ArgumentNullException("attribute");
			
			Type extensionServerType = attribute.ExtensionServerType;
			
			ExtensionServer server;
			if (_extensionServers.TryGetValue(extensionServerType, out server))
				return server;
			
			server = (ExtensionServer)Activator.CreateInstance(extensionServerType);
			server.InitializeExtensionServer(_context);
			_extensionServers[extensionServerType] = server;
			server.ShouldApplyExtensionsInvalidated += delegate(object sender, DesignItemCollectionEventArgs e) {
				ReapplyExtensions(e.Items, (ExtensionServer)sender);
			};
			return server;
		}