Esempio n. 1
0
        /// <summary>
        /// Creates a view for the specified extension point and GUI toolkit.
        /// </summary>
        /// <param name="extensionPoint">The view extension point.</param>
        /// <param name="toolkitId">The identifier of the desired GUI toolkit.</param>
        /// <returns>A new instance of a view extension for the specified extension point.</returns>
        /// <exception cref="NotSupportedException">Thrown if a view extension matching the specified GUI toolkit does not exist.</exception>
        public static IView CreateView(IExtensionPoint extensionPoint, string toolkitId)
        {
            // create an attribute representing the GUI toolkitID
            GuiToolkitAttribute toolkitAttr = new GuiToolkitAttribute(toolkitId);

            // create an extension that is tagged with the same toolkit
            return((IView)extensionPoint.CreateExtension(new AttributeExtensionFilter(toolkitAttr)));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a view for the specified extension point and GUI toolkit.
        /// </summary>
        /// <param name="extensionPoint">The view extension point.</param>
        /// <param name="toolkitID">The desired GUI toolkit.</param>
        /// <returns>The view object that was created.</returns>
        /// <exception cref="NotSupportedException">A view extension matching the specified GUI toolkit does not exist.</exception>
        public static IView CreateView(IExtensionPoint extensionPoint, string toolkitID)
        {
            // create an attribute representing the GUI toolkitID
            GuiToolkitAttribute toolkitAttr = new GuiToolkitAttribute(toolkitID);

            // create an extension that is tagged with the same toolkit
            return (IView)extensionPoint.CreateExtension(new AttributeExtensionFilter(toolkitAttr));
        }
Esempio n. 3
0
        /// <summary>
        /// Obtains an instance of the service that implements the specified contract.
        /// </summary>
        /// <returns></returns>
        public object GetService(Type serviceContract)
        {
            lock (_syncLock)
            {
                // instantiate service object
                object service = _serviceExtensionPoint.CreateExtension(new TypeExtensionFilter(serviceContract));

                // note: _proxyGenerator does internal caching based on service contract
                // so subsequent calls based on the same contract will be fast
                var aopChain = new AopInterceptorChain(_interceptors);
                return(_proxyGenerator.CreateInterfaceProxyWithTarget(serviceContract, service, aopChain));
            }
        }